import datetimeimport seaborn as snsimport timeimport matplotlib.pyplot as plt%matplotlib inlinefrom sklearn.decomposition import PCAimport mathfrom sklearn.metrics import mean_squared_errorfrom sklearn.preprocessing import StandardScalerfrom sklearn.model_selection import cross_val_scorefrom sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import MinMaxScalerfrom sklearn.preprocessing import minmax_scalefrom sklearn.preprocessing import MaxAbsScalerfrom sklearn.preprocessing import StandardScalerfrom sklearn.preprocessing import RobustScalerfrom sklearn.preprocessing import Normalizerfrom sklearn.metrics import r2_scorefrom sklearn.metrics import accuracy_score# Other packagesimport numpy as npimport pandas as pdimport reimport scipy as spimport xgboost as xgbimport matplotlib.pyplot as pltfrom numpy import concatenatefrom pandas import DataFrame, Series, read_csv, scatter_matriximport warningswarnings.filterwarnings("ignore")SP500_TechIndicator = read_csv('SP500_tech_Indicator.csv')#SP500_TechIndicator = SP500_TechIndicator.drop(['Unnamed: 0'], axis=1)SP500_TechIndicator.shapeSP500_TechIndicator#Activision_Blizzard_FFTActivision_Blizzard_FT = SP500_TechIndicator[['Date', 'Activision_Blizzard_Close']]Activision_Blizzard_Close_fft = np.fft.fft(np.asarray(Activision_Blizzard_FT['Activision_Blizzard_Close'].tolist()))Activision_Blizzard_fft_df = pd.DataFrame({'Activision_Blizzard_final_fft':Activision_Blizzard_Close_fft})Activision_Blizzard_fft_df['Activision_Blizzard_fft_absolute'] = Activision_Blizzard_fft_df['Activision_Blizzard_final_fft'].apply(lambda x: np.abs(x))Activision_Blizzard_fft_df['Activision_Blizzard_fft_angle'] = Activision_Blizzard_fft_df['Activision_Blizzard_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Activision_Blizzard_fft_list = np.asarray(Activision_Blizzard_fft_df['Activision_Blizzard_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Activision_Blizzard_fft_list_m10= np.copy(Activision_Blizzard_fft_list); Activision_Blizzard_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Activision_Blizzard_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Activision_Blizzard_FT['Activision_Blizzard_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Activision Blizzard(close) stock prices & Fourier transforms')plt.legend()plt.show()Activision_Blizzard_fft_df#Alphabet_Inc_Class_A_FFTAlphabet_Inc_Class_A_FT = SP500_TechIndicator[['Date', 'Alphabet_Inc_Class_A_Close']]Alphabet_Inc_Class_A_Close_fft = np.fft.fft(np.asarray(Alphabet_Inc_Class_A_FT['Alphabet_Inc_Class_A_Close'].tolist()))Alphabet_Inc_Class_A_fft_df = pd.DataFrame({'Alphabet_Inc_Class_A_final_fft':Alphabet_Inc_Class_A_Close_fft})Alphabet_Inc_Class_A_fft_df['Alphabet_Inc_Class_A_fft_absolute'] = Alphabet_Inc_Class_A_fft_df['Alphabet_Inc_Class_A_final_fft'].apply(lambda x: np.abs(x))Alphabet_Inc_Class_A_fft_df['Alphabet_Inc_Class_A_fft_angle'] = Alphabet_Inc_Class_A_fft_df['Alphabet_Inc_Class_A_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Alphabet_Inc_Class_A_fft_list = np.asarray(Alphabet_Inc_Class_A_fft_df['Alphabet_Inc_Class_A_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Alphabet_Inc_Class_A_fft_list_m10= np.copy(Alphabet_Inc_Class_A_fft_list); Alphabet_Inc_Class_A_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Alphabet_Inc_Class_A_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Alphabet_Inc_Class_A_FT['Alphabet_Inc_Class_A_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Alphabet_Inc_Class_A(close) stock prices & Fourier transforms')plt.legend()plt.show()#ATT_FFTATT_FT = SP500_TechIndicator[['Date', 'ATT_Close']]ATT_Close_fft = np.fft.fft(np.asarray(ATT_FT['ATT_Close'].tolist()))ATT_fft_df = pd.DataFrame({'ATT_final_fft':ATT_Close_fft})ATT_fft_df['ATT_fft_absolute'] = ATT_fft_df['ATT_final_fft'].apply(lambda x: np.abs(x))ATT_fft_df['ATT_fft_angle'] = ATT_fft_df['ATT_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)ATT_fft_list = np.asarray(ATT_fft_df['ATT_final_fft'].tolist())for num_ in [3, 6, 9, 100]: ATT_fft_list_m10= np.copy(ATT_fft_list); ATT_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(ATT_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(ATT_FT['ATT_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: ATT (close) stock prices & Fourier transforms')plt.legend()plt.show()#CBS_FFTCBS_FT = SP500_TechIndicator[['Date', 'CBS_Close']]CBS_Close_fft = np.fft.fft(np.asarray(CBS_FT['CBS_Close'].tolist()))CBS_fft_df = pd.DataFrame({'CBS_final_fft':CBS_Close_fft})CBS_fft_df['CBS_fft_absolute'] = CBS_fft_df['CBS_final_fft'].apply(lambda x: np.abs(x))CBS_fft_df['CBS_fft_angle'] = CBS_fft_df['CBS_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)CBS_fft_list = np.asarray(CBS_fft_df['CBS_final_fft'].tolist())for num_ in [3, 6, 9, 100]: CBS_fft_list_m10= np.copy(CBS_fft_list); CBS_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(CBS_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(CBS_FT['CBS_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: CBS (close) stock prices & Fourier transforms')plt.legend()plt.show()#CenturyLink_FFTCenturyLink_FT = SP500_TechIndicator[['Date', 'CenturyLink_Close']]CenturyLink_Close_fft = np.fft.fft(np.asarray(CenturyLink_FT['CenturyLink_Close'].tolist()))CenturyLink_fft_df = pd.DataFrame({'CenturyLink_final_fft':CenturyLink_Close_fft})CenturyLink_fft_df['CenturyLink_fft_absolute'] = CenturyLink_fft_df['CenturyLink_final_fft'].apply(lambda x: np.abs(x))CenturyLink_fft_df['CenturyLink_fft_angle'] = CenturyLink_fft_df['CenturyLink_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)CenturyLink_fft_list = np.asarray(CenturyLink_fft_df['CenturyLink_final_fft'].tolist())for num_ in [3, 6, 9, 100]: CenturyLink_fft_list_m10= np.copy(CenturyLink_fft_list); CenturyLink_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(CenturyLink_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(CenturyLink_FT['CenturyLink_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: CenturyLink (close) stock prices & Fourier transforms')plt.legend()plt.show()#Comcast_FFTComcast_FT = SP500_TechIndicator[['Date', 'Comcast_Close']]Comcast_Close_fft = np.fft.fft(np.asarray(Comcast_FT['Comcast_Close'].tolist()))Comcast_fft_df = pd.DataFrame({'Comcast_final_fft':Comcast_Close_fft})Comcast_fft_df['Comcast_fft_absolute'] = Comcast_fft_df['Comcast_final_fft'].apply(lambda x: np.abs(x))Comcast_fft_df['Comcast_fft_angle'] = Comcast_fft_df['Comcast_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Comcast_fft_list = np.asarray(Comcast_fft_df['Comcast_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Comcast_fft_list_m10= np.copy(Comcast_fft_list); Comcast_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Comcast_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Comcast_FT['Comcast_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Comcast (close) stock prices & Fourier transforms')plt.legend()plt.show()#Discovery_Class_A_FFTDiscovery_Class_A_FT = SP500_TechIndicator[['Date', 'Discovery_Class_A_Close']]Discovery_Class_A_Close_fft = np.fft.fft(np.asarray(Discovery_Class_A_FT['Discovery_Class_A_Close'].tolist()))Discovery_Class_A_fft_df = pd.DataFrame({'Discovery_Class_A_final_fft':Discovery_Class_A_Close_fft})Discovery_Class_A_fft_df['Discovery_Class_A_fft_absolute'] = Discovery_Class_A_fft_df['Discovery_Class_A_final_fft'].apply(lambda x: np.abs(x))Discovery_Class_A_fft_df['Discovery_Class_A_fft_angle'] = Discovery_Class_A_fft_df['Discovery_Class_A_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Discovery_Class_A_fft_list = np.asarray(Discovery_Class_A_fft_df['Discovery_Class_A_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Discovery_Class_A_fft_list_m10= np.copy(Discovery_Class_A_fft_list); Discovery_Class_A_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Discovery_Class_A_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Discovery_Class_A_FT['Discovery_Class_A_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Discovery_Class_A (close) stock prices & Fourier transforms')plt.legend()plt.show()#Discovery_Class_C_FFTDiscovery_Class_C_FT = SP500_TechIndicator[['Date', 'Discovery_Class_C_Close']]Discovery_Class_C_Close_fft = np.fft.fft(np.asarray(Discovery_Class_C_FT['Discovery_Class_C_Close'].tolist()))Discovery_Class_C_fft_df = pd.DataFrame({'Discovery_Class_C_final_fft':Discovery_Class_C_Close_fft})Discovery_Class_C_fft_df['Discovery_Class_C_fft_absolute'] = Discovery_Class_C_fft_df['Discovery_Class_C_final_fft'].apply(lambda x: np.abs(x))Discovery_Class_C_fft_df['Discovery_Class_C_fft_angle'] = Discovery_Class_C_fft_df['Discovery_Class_C_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Discovery_Class_C_fft_list = np.asarray(Discovery_Class_C_fft_df['Discovery_Class_C_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Discovery_Class_C_fft_list_m10= np.copy(Discovery_Class_C_fft_list); Discovery_Class_C_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Discovery_Class_C_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Discovery_Class_C_FT['Discovery_Class_C_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Discovery_Class_C (close) stock prices & Fourier transforms')plt.legend()plt.show()#Dish_FFTDish_FT = SP500_TechIndicator[['Date', 'Dish_Close']]Dish_Close_fft = np.fft.fft(np.asarray(Dish_FT['Dish_Close'].tolist()))Dish_fft_df = pd.DataFrame({'Dish_final_fft':Dish_Close_fft})Dish_fft_df['Dish_fft_absolute'] = Dish_fft_df['Dish_final_fft'].apply(lambda x: np.abs(x))Dish_fft_df['Dish_fft_angle'] = Dish_fft_df['Dish_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Dish_fft_list = np.asarray(Dish_fft_df['Dish_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Dish_fft_list_m10= np.copy(Dish_fft_list); Dish_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Dish_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Dish_FT['Dish_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Dish (close) stock prices & Fourier transforms')plt.legend()plt.show()#Electronic_Arts_FFTElectronic_Arts_FT = SP500_TechIndicator[['Date', 'Electronic_Arts_Close']]Electronic_Arts_Close_fft = np.fft.fft(np.asarray(Electronic_Arts_FT['Electronic_Arts_Close'].tolist()))Electronic_Arts_fft_df = pd.DataFrame({'Electronic_Arts_final_fft':Electronic_Arts_Close_fft})Electronic_Arts_fft_df['Electronic_Arts_fft_absolute'] = Electronic_Arts_fft_df['Electronic_Arts_final_fft'].apply(lambda x: np.abs(x))Electronic_Arts_fft_df['Electronic_Arts_fft_angle'] = Electronic_Arts_fft_df['Electronic_Arts_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Electronic_Arts_fft_list = np.asarray(Electronic_Arts_fft_df['Electronic_Arts_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Electronic_Arts_fft_list_m10= np.copy(Electronic_Arts_fft_list); Electronic_Arts_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Electronic_Arts_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Electronic_Arts_FT['Electronic_Arts_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Electronic_Arts (close) stock prices & Fourier transforms')plt.legend()plt.show()#Facebook_FFTFacebook_FT = SP500_TechIndicator[['Date', 'Facebook_Close']]Facebook_Close_fft = np.fft.fft(np.asarray(Facebook_FT['Facebook_Close'].tolist()))Facebook_fft_df = pd.DataFrame({'Facebook_final_fft':Facebook_Close_fft})Facebook_fft_df['Facebook_fft_absolute'] = Facebook_fft_df['Facebook_final_fft'].apply(lambda x: np.abs(x))Facebook_fft_df['Facebook_fft_angle'] = Facebook_fft_df['Facebook_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Facebook_fft_list = np.asarray(Facebook_fft_df['Facebook_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Facebook_fft_list_m10= np.copy(Facebook_fft_list); Facebook_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Facebook_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Facebook_FT['Facebook_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Facebook (close) stock prices & Fourier transforms')plt.legend()plt.show()#Interpublic_Group_FFTInterpublic_Group_FT = SP500_TechIndicator[['Date', 'Interpublic_Group_Close']]Interpublic_Group_Close_fft = np.fft.fft(np.asarray(Interpublic_Group_FT['Interpublic_Group_Close'].tolist()))Interpublic_Group_fft_df = pd.DataFrame({'Interpublic_Group_final_fft':Interpublic_Group_Close_fft})Interpublic_Group_fft_df['Interpublic_Group_fft_absolute'] = Interpublic_Group_fft_df['Interpublic_Group_final_fft'].apply(lambda x: np.abs(x))Interpublic_Group_fft_df['Interpublic_Group_fft_angle'] = Interpublic_Group_fft_df['Interpublic_Group_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Interpublic_Group_fft_list = np.asarray(Interpublic_Group_fft_df['Interpublic_Group_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Interpublic_Group_fft_list_m10= np.copy(Interpublic_Group_fft_list); Interpublic_Group_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Interpublic_Group_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Interpublic_Group_FT['Interpublic_Group_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Interpublic_Group (close) stock prices & Fourier transforms')plt.legend()plt.show()#Netflix_FFTNetflix_FT = SP500_TechIndicator[['Date', 'Netflix_Close']]Netflix_Close_fft = np.fft.fft(np.asarray(Netflix_FT['Netflix_Close'].tolist()))Netflix_fft_df = pd.DataFrame({'Netflix_final_fft':Netflix_Close_fft})Netflix_fft_df['Netflix_fft_absolute'] = Netflix_fft_df['Netflix_final_fft'].apply(lambda x: np.abs(x))Netflix_fft_df['Netflix_fft_angle'] = Netflix_fft_df['Netflix_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Netflix_fft_list = np.asarray(Netflix_fft_df['Netflix_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Netflix_fft_list_m10= np.copy(Netflix_fft_list); Netflix_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Netflix_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Netflix_FT['Netflix_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Netflix (close) stock prices & Fourier transforms')plt.legend()plt.show()#News_Corp_Class_A_FFTNews_Corp_Class_A_FT = SP500_TechIndicator[['Date', 'News_Corp_Class_A_Close']]News_Corp_Class_A_Close_fft = np.fft.fft(np.asarray(News_Corp_Class_A_FT['News_Corp_Class_A_Close'].tolist()))News_Corp_Class_A_fft_df = pd.DataFrame({'News_Corp_Class_A_final_fft':News_Corp_Class_A_Close_fft})News_Corp_Class_A_fft_df['News_Corp_Class_A_fft_absolute'] = News_Corp_Class_A_fft_df['News_Corp_Class_A_final_fft'].apply(lambda x: np.abs(x))News_Corp_Class_A_fft_df['News_Corp_Class_A_fft_angle'] = News_Corp_Class_A_fft_df['News_Corp_Class_A_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)News_Corp_Class_A_fft_list = np.asarray(News_Corp_Class_A_fft_df['News_Corp_Class_A_final_fft'].tolist())for num_ in [3, 6, 9, 100]: News_Corp_Class_A_fft_list_m10= np.copy(News_Corp_Class_A_fft_list); News_Corp_Class_A_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(News_Corp_Class_A_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(News_Corp_Class_A_FT['News_Corp_Class_A_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: News_Corp_Class_A (close) stock prices & Fourier transforms')plt.legend()plt.show()#News_Corp_Class_B_FFTNews_Corp_Class_B_FT = SP500_TechIndicator[['Date', 'News_Corp_Class_B_Close']]News_Corp_Class_B_Close_fft = np.fft.fft(np.asarray(News_Corp_Class_B_FT['News_Corp_Class_B_Close'].tolist()))News_Corp_Class_B_fft_df = pd.DataFrame({'News_Corp_Class_B_final_fft':News_Corp_Class_B_Close_fft})News_Corp_Class_B_fft_df['News_Corp_Class_B_fft_absolute'] = News_Corp_Class_B_fft_df['News_Corp_Class_B_final_fft'].apply(lambda x: np.abs(x))News_Corp_Class_B_fft_df['News_Corp_Class_B_fft_angle'] = News_Corp_Class_B_fft_df['News_Corp_Class_B_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)News_Corp_Class_B_fft_list = np.asarray(News_Corp_Class_B_fft_df['News_Corp_Class_B_final_fft'].tolist())for num_ in [3, 6, 9, 100]: News_Corp_Class_B_fft_list_m10= np.copy(News_Corp_Class_B_fft_list); News_Corp_Class_B_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(News_Corp_Class_B_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(News_Corp_Class_B_FT['News_Corp_Class_B_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: News_Corp_Class_B (close) stock prices & Fourier transforms')plt.legend()plt.show()#Omnicom_Group_FFTOmnicom_Group_FT = SP500_TechIndicator[['Date', 'Omnicom_Group_Close']]Omnicom_Group_Close_fft = np.fft.fft(np.asarray(Omnicom_Group_FT['Omnicom_Group_Close'].tolist()))Omnicom_Group_fft_df = pd.DataFrame({'Omnicom_Group_final_fft':Omnicom_Group_Close_fft})Omnicom_Group_fft_df['Omnicom_Group_fft_absolute'] = Omnicom_Group_fft_df['Omnicom_Group_final_fft'].apply(lambda x: np.abs(x))Omnicom_Group_fft_df['Omnicom_Group_fft_angle'] = Omnicom_Group_fft_df['Omnicom_Group_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Omnicom_Group_fft_list = np.asarray(Omnicom_Group_fft_df['Omnicom_Group_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Omnicom_Group_fft_list_m10= np.copy(Omnicom_Group_fft_list); Omnicom_Group_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Omnicom_Group_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Omnicom_Group_FT['Omnicom_Group_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Omnicom_Group (close) stock prices & Fourier transforms')plt.legend()plt.show()#Take_Two_Interactive_FFTTake_Two_Interactive_FT = SP500_TechIndicator[['Date', 'Take_Two_Interactive_Close']]Take_Two_Interactive_Close_fft = np.fft.fft(np.asarray(Take_Two_Interactive_FT['Take_Two_Interactive_Close'].tolist()))Take_Two_Interactive_fft_df = pd.DataFrame({'Take_Two_Interactive_final_fft':Take_Two_Interactive_Close_fft})Take_Two_Interactive_fft_df['Take_Two_Interactive_fft_absolute'] = Take_Two_Interactive_fft_df['Take_Two_Interactive_final_fft'].apply(lambda x: np.abs(x))Take_Two_Interactive_fft_df['Take_Two_Interactive_fft_angle'] = Take_Two_Interactive_fft_df['Take_Two_Interactive_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Take_Two_Interactive_fft_list = np.asarray(Take_Two_Interactive_fft_df['Take_Two_Interactive_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Take_Two_Interactive_fft_list_m10= np.copy(Take_Two_Interactive_fft_list); Take_Two_Interactive_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Take_Two_Interactive_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Take_Two_Interactive_FT['Take_Two_Interactive_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Take_Two_Interactive (close) stock prices & Fourier transforms')plt.legend()plt.show()#Twitter_FFTTwitter_FT = SP500_TechIndicator[['Date', 'Twitter_Close']]Twitter_Close_fft = np.fft.fft(np.asarray(Twitter_FT['Twitter_Close'].tolist()))Twitter_fft_df = pd.DataFrame({'Twitter_final_fft':Twitter_Close_fft})Twitter_fft_df['Twitter_fft_absolute'] = Twitter_fft_df['Twitter_final_fft'].apply(lambda x: np.abs(x))Twitter_fft_df['Twitter_fft_angle'] = Twitter_fft_df['Twitter_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Twitter_fft_list = np.asarray(Twitter_fft_df['Twitter_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Twitter_fft_list_m10= np.copy(Twitter_fft_list); Twitter_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Twitter_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Twitter_FT['Twitter_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Twitter (close) stock prices & Fourier transforms')plt.legend()plt.show()plt.figure(figsize=(14, 7), dpi=100)fft_list = np.asarray(fft_df['fft'].tolist())for num_ in [3, 6, 9, 100]: fft_list_m10= np.copy(fft_list); fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(data_FT['Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: J P Morgan (close) stock prices & Fourier transforms')plt.legend()plt.show()#TripAdvisor_FFTTripAdvisor_FT = SP500_TechIndicator[['Date', 'TripAdvisor_Close']]TripAdvisor_Close_fft = np.fft.fft(np.asarray(TripAdvisor_FT['TripAdvisor_Close'].tolist()))TripAdvisor_fft_df = pd.DataFrame({'TripAdvisor_final_fft':TripAdvisor_Close_fft})TripAdvisor_fft_df['TripAdvisor_fft_absolute'] = TripAdvisor_fft_df['TripAdvisor_final_fft'].apply(lambda x: np.abs(x))TripAdvisor_fft_df['TripAdvisor_fft_angle'] = TripAdvisor_fft_df['TripAdvisor_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)TripAdvisor_fft_list = np.asarray(TripAdvisor_fft_df['TripAdvisor_final_fft'].tolist())for num_ in [3, 6, 9, 100]: TripAdvisor_fft_list_m10= np.copy(TripAdvisor_fft_list); TripAdvisor_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(TripAdvisor_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(TripAdvisor_FT['TripAdvisor_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: TripAdvisor (close) stock prices & Fourier transforms')plt.legend()plt.show()#TwentyFirst_Century_Fox_A_FFTTwentyFirst_Century_Fox_A_FT = SP500_TechIndicator[['Date', 'TwentyFirst_Century_Fox_A_Close']]TwentyFirst_Century_Fox_A_Close_fft = np.fft.fft(np.asarray(TwentyFirst_Century_Fox_A_FT['TwentyFirst_Century_Fox_A_Close'].tolist()))TwentyFirst_Century_Fox_A_fft_df = pd.DataFrame({'TwentyFirst_Century_Fox_A_final_fft':TwentyFirst_Century_Fox_A_Close_fft})TwentyFirst_Century_Fox_A_fft_df['TwentyFirst_Century_Fox_A_fft_absolute'] = TwentyFirst_Century_Fox_A_fft_df['TwentyFirst_Century_Fox_A_final_fft'].apply(lambda x: np.abs(x))TwentyFirst_Century_Fox_A_fft_df['TwentyFirst_Century_Fox_A_fft_angle'] = TwentyFirst_Century_Fox_A_fft_df['TwentyFirst_Century_Fox_A_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)TwentyFirst_Century_Fox_A_fft_list = np.asarray(TwentyFirst_Century_Fox_A_fft_df['TwentyFirst_Century_Fox_A_final_fft'].tolist())for num_ in [3, 6, 9, 100]: TwentyFirst_Century_Fox_A_fft_list_m10= np.copy(TwentyFirst_Century_Fox_A_fft_list); TwentyFirst_Century_Fox_A_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(TwentyFirst_Century_Fox_A_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(TwentyFirst_Century_Fox_A_FT['TwentyFirst_Century_Fox_A_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: TwentyFirst_Century_Fox_A (close) stock prices & Fourier transforms')plt.legend()plt.show()#TwentyFirst_Century_Fox_B_FFTTwentyFirst_Century_Fox_B_FT = SP500_TechIndicator[['Date', 'TwentyFirst_Century_Fox_B_Close']]TwentyFirst_Century_Fox_B_Close_fft = np.fft.fft(np.asarray(TwentyFirst_Century_Fox_B_FT['TwentyFirst_Century_Fox_B_Close'].tolist()))TwentyFirst_Century_Fox_B_fft_df = pd.DataFrame({'TwentyFirst_Century_Fox_B_final_fft':TwentyFirst_Century_Fox_B_Close_fft})TwentyFirst_Century_Fox_B_fft_df['TwentyFirst_Century_Fox_B_fft_absolute'] = TwentyFirst_Century_Fox_B_fft_df['TwentyFirst_Century_Fox_B_final_fft'].apply(lambda x: np.abs(x))TwentyFirst_Century_Fox_B_fft_df['TwentyFirst_Century_Fox_B_fft_angle'] = TwentyFirst_Century_Fox_B_fft_df['TwentyFirst_Century_Fox_B_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)TwentyFirst_Century_Fox_B_fft_list = np.asarray(TwentyFirst_Century_Fox_B_fft_df['TwentyFirst_Century_Fox_B_final_fft'].tolist())for num_ in [3, 6, 9, 100]: TwentyFirst_Century_Fox_B_fft_list_m10= np.copy(TwentyFirst_Century_Fox_B_fft_list); TwentyFirst_Century_Fox_B_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(TwentyFirst_Century_Fox_B_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(TwentyFirst_Century_Fox_B_FT['TwentyFirst_Century_Fox_B_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: TwentyFirst_Century_Fox_B (close) stock prices & Fourier transforms')plt.legend()plt.show()#Verizon_Communications_FFTVerizon_Communications_FT = SP500_TechIndicator[['Date', 'Verizon_Communications_Close']]Verizon_Communications_Close_fft = np.fft.fft(np.asarray(Verizon_Communications_FT['Verizon_Communications_Close'].tolist()))Verizon_Communications_fft_df = pd.DataFrame({'Verizon_Communications_final_fft':Verizon_Communications_Close_fft})Verizon_Communications_fft_df['Verizon_Communications_fft_absolute'] = Verizon_Communications_fft_df['Verizon_Communications_final_fft'].apply(lambda x: np.abs(x))Verizon_Communications_fft_df['Verizon_Communications_fft_angle'] = Verizon_Communications_fft_df['Verizon_Communications_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Verizon_Communications_fft_list = np.asarray(Verizon_Communications_fft_df['Verizon_Communications_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Verizon_Communications_fft_list_m10= np.copy(Verizon_Communications_fft_list); Verizon_Communications_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Verizon_Communications_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Verizon_Communications_FT['Verizon_Communications_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Verizon_Communications (close) stock prices & Fourier transforms')plt.legend()plt.show()#Viacom_FFTViacom_FT = SP500_TechIndicator[['Date', 'Viacom_Close']]Viacom_Close_fft = np.fft.fft(np.asarray(Viacom_FT['Viacom_Close'].tolist()))Viacom_fft_df = pd.DataFrame({'Viacom_final_fft':Viacom_Close_fft})Viacom_fft_df['Viacom_fft_absolute'] = Viacom_fft_df['Viacom_final_fft'].apply(lambda x: np.abs(x))Viacom_fft_df['Viacom_fft_angle'] = Viacom_fft_df['Viacom_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Viacom_fft_list = np.asarray(Viacom_fft_df['Viacom_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Viacom_fft_list_m10= np.copy(Viacom_fft_list); Viacom_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Viacom_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Viacom_FT['Viacom_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Viacom (close) stock prices & Fourier transforms')plt.legend()plt.show()#The_Walt_Disney_FFTThe_Walt_Disney_FT = SP500_TechIndicator[['Date', 'The_Walt_Disney_Close']]The_Walt_Disney_Close_fft = np.fft.fft(np.asarray(The_Walt_Disney_FT['The_Walt_Disney_Close'].tolist()))The_Walt_Disney_fft_df = pd.DataFrame({'The_Walt_Disney_final_fft':The_Walt_Disney_Close_fft})The_Walt_Disney_fft_df['The_Walt_Disney_fft_absolute'] = The_Walt_Disney_fft_df['The_Walt_Disney_final_fft'].apply(lambda x: np.abs(x))The_Walt_Disney_fft_df['The_Walt_Disney_fft_angle'] = The_Walt_Disney_fft_df['The_Walt_Disney_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)The_Walt_Disney_fft_list = np.asarray(The_Walt_Disney_fft_df['The_Walt_Disney_final_fft'].tolist())for num_ in [3, 6, 9, 100]: The_Walt_Disney_fft_list_m10= np.copy(The_Walt_Disney_fft_list); The_Walt_Disney_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(The_Walt_Disney_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(The_Walt_Disney_FT['The_Walt_Disney_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: The_Walt_Disney (close) stock prices & Fourier transforms')plt.legend()plt.show()Communication_Services_FFT = pd.concat((Activision_Blizzard_fft_df,ATT_fft_df,CBS_fft_df,CenturyLink_fft_df,Comcast_fft_df, Discovery_Class_A_fft_df, Discovery_Class_C_fft_df,Dish_fft_df,Electronic_Arts_fft_df,Facebook_fft_df, Interpublic_Group_fft_df, Netflix_fft_df, News_Corp_Class_A_fft_df, News_Corp_Class_B_fft_df, Omnicom_Group_fft_df, Take_Two_Interactive_fft_df, Twitter_fft_df, TripAdvisor_fft_df, TwentyFirst_Century_Fox_A_fft_df, TwentyFirst_Century_Fox_B_fft_df, Verizon_Communications_fft_df, Viacom_fft_df, The_Walt_Disney_fft_df), axis=1, join='inner')Communication_Services_FFT#Advance_Auto_Parts_FFTAdvance_Auto_Parts_FT = SP500_TechIndicator[['Date', 'Advance_Auto_Parts_Close']]Advance_Auto_Parts_Close_fft = np.fft.fft(np.asarray(Advance_Auto_Parts_FT['Advance_Auto_Parts_Close'].tolist()))Advance_Auto_Parts_fft_df = pd.DataFrame({'Advance_Auto_Parts_final_fft':Advance_Auto_Parts_Close_fft})Advance_Auto_Parts_fft_df['Advance_Auto_Parts_fft_absolute'] = Advance_Auto_Parts_fft_df['Advance_Auto_Parts_final_fft'].apply(lambda x: np.abs(x))Advance_Auto_Parts_fft_df['Advance_Auto_Parts_fft_angle'] = Advance_Auto_Parts_fft_df['Advance_Auto_Parts_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Advance_Auto_Parts_fft_list = np.asarray(Advance_Auto_Parts_fft_df['Advance_Auto_Parts_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Advance_Auto_Parts_fft_list_m10= np.copy(Advance_Auto_Parts_fft_list); Advance_Auto_Parts_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Advance_Auto_Parts_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Advance_Auto_Parts_FT['Advance_Auto_Parts_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Advance_Auto_Parts (close) stock prices & Fourier transforms')plt.legend()plt.show()#Amazon_FFTAmazon_FT = SP500_TechIndicator[['Date', 'Amazon_Close']]Amazon_Close_fft = np.fft.fft(np.asarray(Amazon_FT['Amazon_Close'].tolist()))Amazon_fft_df = pd.DataFrame({'Amazon_final_fft':Amazon_Close_fft})Amazon_fft_df['Amazon_fft_absolute'] = Amazon_fft_df['Amazon_final_fft'].apply(lambda x: np.abs(x))Amazon_fft_df['Amazon_fft_angle'] = Amazon_fft_df['Amazon_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Amazon_fft_list = np.asarray(Amazon_fft_df['Amazon_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Amazon_fft_list_m10= np.copy(Amazon_fft_list); Amazon_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Amazon_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Amazon_FT['Amazon_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Amazon (close) stock prices & Fourier transforms')plt.legend()plt.show()#AutoZone_FFTAutoZone_FT = SP500_TechIndicator[['Date', 'AutoZone_Close']]AutoZone_Close_fft = np.fft.fft(np.asarray(AutoZone_FT['AutoZone_Close'].tolist()))AutoZone_fft_df = pd.DataFrame({'AutoZone_final_fft':AutoZone_Close_fft})AutoZone_fft_df['AutoZone_fft_absolute'] = AutoZone_fft_df['AutoZone_final_fft'].apply(lambda x: np.abs(x))AutoZone_fft_df['AutoZone_fft_angle'] = AutoZone_fft_df['AutoZone_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)AutoZone_fft_list = np.asarray(AutoZone_fft_df['AutoZone_final_fft'].tolist())for num_ in [3, 6, 9, 100]: AutoZone_fft_list_m10= np.copy(AutoZone_fft_list); AutoZone_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(AutoZone_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(AutoZone_FT['AutoZone_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: AutoZone (close) stock prices & Fourier transforms')plt.legend()plt.show()#Best_Buy_Co_FFTBest_Buy_Co_FT = SP500_TechIndicator[['Date', 'Best_Buy_Co_Close']]Best_Buy_Co_Close_fft = np.fft.fft(np.asarray(Best_Buy_Co_FT['Best_Buy_Co_Close'].tolist()))Best_Buy_Co_fft_df = pd.DataFrame({'Best_Buy_Co_final_fft':Best_Buy_Co_Close_fft})Best_Buy_Co_fft_df['Best_Buy_Co_fft_absolute'] = Best_Buy_Co_fft_df['Best_Buy_Co_final_fft'].apply(lambda x: np.abs(x))Best_Buy_Co_fft_df['Best_Buy_Co_fft_angle'] = Best_Buy_Co_fft_df['Best_Buy_Co_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Best_Buy_Co_fft_list = np.asarray(Best_Buy_Co_fft_df['Best_Buy_Co_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Best_Buy_Co_fft_list_m10= np.copy(Best_Buy_Co_fft_list); Best_Buy_Co_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Best_Buy_Co_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Best_Buy_Co_FT['Best_Buy_Co_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Best_Buy_Co (close) stock prices & Fourier transforms')plt.legend()plt.show()#BlockHR_FFTBlockHR_FT = SP500_TechIndicator[['Date', 'BlockHR_Close']]BlockHR_Close_fft = np.fft.fft(np.asarray(BlockHR_FT['BlockHR_Close'].tolist()))BlockHR_fft_df = pd.DataFrame({'BlockHR_final_fft':BlockHR_Close_fft})BlockHR_fft_df['BlockHR_fft_absolute'] = BlockHR_fft_df['BlockHR_final_fft'].apply(lambda x: np.abs(x))BlockHR_fft_df['BlockHR_fft_angle'] = BlockHR_fft_df['BlockHR_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)BlockHR_fft_list = np.asarray(BlockHR_fft_df['BlockHR_final_fft'].tolist())for num_ in [3, 6, 9, 100]: BlockHR_fft_list_m10= np.copy(BlockHR_fft_list); BlockHR_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(BlockHR_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(BlockHR_FT['BlockHR_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: BlockHR (close) stock prices & Fourier transforms')plt.legend()plt.show()#BorgWarner_FFTBorgWarner_FT = SP500_TechIndicator[['Date', 'BorgWarner_Close']]BorgWarner_Close_fft = np.fft.fft(np.asarray(BorgWarner_FT['BorgWarner_Close'].tolist()))BorgWarner_fft_df = pd.DataFrame({'BorgWarner_final_fft':BorgWarner_Close_fft})BorgWarner_fft_df['BorgWarner_fft_absolute'] = BorgWarner_fft_df['BorgWarner_final_fft'].apply(lambda x: np.abs(x))BorgWarner_fft_df['BorgWarner_fft_angle'] = BorgWarner_fft_df['BorgWarner_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)BorgWarner_fft_list = np.asarray(BorgWarner_fft_df['BorgWarner_final_fft'].tolist())for num_ in [3, 6, 9, 100]: BorgWarner_fft_list_m10= np.copy(BorgWarner_fft_list); BorgWarner_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(BorgWarner_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(BorgWarner_FT['BorgWarner_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: BorgWarner (close) stock prices & Fourier transforms')plt.legend()plt.show()#Carmax_FFTCarmax_FT = SP500_TechIndicator[['Date', 'Carmax_Close']]Carmax_Close_fft = np.fft.fft(np.asarray(Carmax_FT['Carmax_Close'].tolist()))Carmax_fft_df = pd.DataFrame({'Carmax_final_fft':Carmax_Close_fft})Carmax_fft_df['Carmax_fft_absolute'] = Carmax_fft_df['Carmax_final_fft'].apply(lambda x: np.abs(x))Carmax_fft_df['Carmax_fft_angle'] = Carmax_fft_df['Carmax_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Carmax_fft_list = np.asarray(Carmax_fft_df['Carmax_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Carmax_fft_list_m10= np.copy(Carmax_fft_list); Carmax_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Carmax_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Carmax_FT['Carmax_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Carmax (close) stock prices & Fourier transforms')plt.legend()plt.show()#Carnival_FFTCarnival_FT = SP500_TechIndicator[['Date', 'Carnival_Close']]Carnival_Close_fft = np.fft.fft(np.asarray(Carnival_FT['Carnival_Close'].tolist()))Carnival_fft_df = pd.DataFrame({'Carnival_final_fft':Carnival_Close_fft})Carnival_fft_df['Carnival_fft_absolute'] = Carnival_fft_df['Carnival_final_fft'].apply(lambda x: np.abs(x))Carnival_fft_df['Carnival_fft_angle'] = Carnival_fft_df['Carnival_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Carnival_fft_list = np.asarray(Carnival_fft_df['Carnival_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Carnival_fft_list_m10= np.copy(Carnival_fft_list); Carnival_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Carnival_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Carnival_FT['Carnival_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Carnival (close) stock prices & Fourier transforms')plt.legend()plt.show()#Chipotle_Mexican_Grill_FFTChipotle_Mexican_Grill_FT = SP500_TechIndicator[['Date', 'Chipotle_Mexican_Grill_Close']]Chipotle_Mexican_Grill_Close_fft = np.fft.fft(np.asarray(Chipotle_Mexican_Grill_FT['Chipotle_Mexican_Grill_Close'].tolist()))Chipotle_Mexican_Grill_fft_df = pd.DataFrame({'Chipotle_Mexican_Grill_final_fft':Chipotle_Mexican_Grill_Close_fft})Chipotle_Mexican_Grill_fft_df['Chipotle_Mexican_Grill_fft_absolute'] = Chipotle_Mexican_Grill_fft_df['Chipotle_Mexican_Grill_final_fft'].apply(lambda x: np.abs(x))Chipotle_Mexican_Grill_fft_df['Chipotle_Mexican_Grill_fft_angle'] = Chipotle_Mexican_Grill_fft_df['Chipotle_Mexican_Grill_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Chipotle_Mexican_Grill_fft_list = np.asarray(Chipotle_Mexican_Grill_fft_df['Chipotle_Mexican_Grill_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Chipotle_Mexican_Grill_fft_list_m10= np.copy(Chipotle_Mexican_Grill_fft_list); Chipotle_Mexican_Grill_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Chipotle_Mexican_Grill_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Chipotle_Mexican_Grill_FT['Chipotle_Mexican_Grill_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Chipotle_Mexican_Grill (close) stock prices & Fourier transforms')plt.legend()plt.show()#D_R_Horton_FFTD_R_Horton_FT = SP500_TechIndicator[['Date', 'D_R_Horton_Close']]D_R_Horton_Close_fft = np.fft.fft(np.asarray(D_R_Horton_FT['D_R_Horton_Close'].tolist()))D_R_Horton_fft_df = pd.DataFrame({'D_R_Horton_final_fft':D_R_Horton_Close_fft})D_R_Horton_fft_df['D_R_Horton_fft_absolute'] = D_R_Horton_fft_df['D_R_Horton_final_fft'].apply(lambda x: np.abs(x))D_R_Horton_fft_df['D_R_Horton_fft_angle'] = D_R_Horton_fft_df['D_R_Horton_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)D_R_Horton_fft_list = np.asarray(D_R_Horton_fft_df['D_R_Horton_final_fft'].tolist())for num_ in [3, 6, 9, 100]: D_R_Horton_fft_list_m10= np.copy(D_R_Horton_fft_list); D_R_Horton_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(D_R_Horton_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(D_R_Horton_FT['D_R_Horton_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: D_R_Horton (close) stock prices & Fourier transforms')plt.legend()plt.show()#Darden_Restaurants_FFTDarden_Restaurants_FT = SP500_TechIndicator[['Date', 'Darden_Restaurants_Close']]Darden_Restaurants_Close_fft = np.fft.fft(np.asarray(Darden_Restaurants_FT['Darden_Restaurants_Close'].tolist()))Darden_Restaurants_fft_df = pd.DataFrame({'Darden_Restaurants_final_fft':Darden_Restaurants_Close_fft})Darden_Restaurants_fft_df['Darden_Restaurants_fft_absolute'] = Darden_Restaurants_fft_df['Darden_Restaurants_final_fft'].apply(lambda x: np.abs(x))Darden_Restaurants_fft_df['Darden_Restaurants_fft_angle'] = Darden_Restaurants_fft_df['Darden_Restaurants_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Darden_Restaurants_fft_list = np.asarray(Darden_Restaurants_fft_df['Darden_Restaurants_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Darden_Restaurants_fft_list_m10= np.copy(Darden_Restaurants_fft_list); Darden_Restaurants_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Darden_Restaurants_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Darden_Restaurants_FT['Darden_Restaurants_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Darden_Restaurants (close) stock prices & Fourier transforms')plt.legend()plt.show()#Dollar_General_FFTDollar_General_FT = SP500_TechIndicator[['Date', 'Dollar_General_Close']]Dollar_General_Close_fft = np.fft.fft(np.asarray(Dollar_General_FT['Dollar_General_Close'].tolist()))Dollar_General_fft_df = pd.DataFrame({'Dollar_General_final_fft':Dollar_General_Close_fft})Dollar_General_fft_df['Dollar_General_fft_absolute'] = Dollar_General_fft_df['Dollar_General_final_fft'].apply(lambda x: np.abs(x))Dollar_General_fft_df['Dollar_General_fft_angle'] = Dollar_General_fft_df['Dollar_General_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Dollar_General_fft_list = np.asarray(Dollar_General_fft_df['Dollar_General_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Dollar_General_fft_list_m10= np.copy(Dollar_General_fft_list); Dollar_General_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Dollar_General_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Dollar_General_FT['Dollar_General_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Dollar_General (close) stock prices & Fourier transforms')plt.legend()plt.show()#Dollar_Tree_FFTDollar_Tree_FT = SP500_TechIndicator[['Date', 'Dollar_Tree_Close']]Dollar_Tree_Close_fft = np.fft.fft(np.asarray(Dollar_Tree_FT['Dollar_Tree_Close'].tolist()))Dollar_Tree_fft_df = pd.DataFrame({'Dollar_Tree_final_fft':Dollar_Tree_Close_fft})Dollar_Tree_fft_df['Dollar_Tree_fft_absolute'] = Dollar_Tree_fft_df['Dollar_Tree_final_fft'].apply(lambda x: np.abs(x))Dollar_Tree_fft_df['Dollar_Tree_fft_angle'] = Dollar_Tree_fft_df['Dollar_Tree_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Dollar_Tree_fft_list = np.asarray(Dollar_Tree_fft_df['Dollar_Tree_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Dollar_Tree_fft_list_m10= np.copy(Dollar_Tree_fft_list); Dollar_Tree_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Dollar_Tree_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Dollar_Tree_FT['Dollar_Tree_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Dollar_Tree (close) stock prices & Fourier transforms')plt.legend()plt.show()#EBay_FFTeBay_FT = SP500_TechIndicator[['Date', 'eBay_Close']]eBay_Close_fft = np.fft.fft(np.asarray(eBay_FT['eBay_Close'].tolist()))eBay_fft_df = pd.DataFrame({'eBay_final_fft':eBay_Close_fft})eBay_fft_df['eBay_fft_absolute'] = eBay_fft_df['eBay_final_fft'].apply(lambda x: np.abs(x))eBay_fft_df['eBay_fft_angle'] = eBay_fft_df['eBay_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)eBay_fft_list = np.asarray(eBay_fft_df['eBay_final_fft'].tolist())for num_ in [3, 6, 9, 100]: eBay_fft_list_m10= np.copy(eBay_fft_list); eBay_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(eBay_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(eBay_FT['eBay_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: EBay (close) stock prices & Fourier transforms')plt.legend()plt.show()#Expedia_Group_FFTExpedia_Group_FT = SP500_TechIndicator[['Date', 'Expedia_Group_Close']]Expedia_Group_Close_fft = np.fft.fft(np.asarray(Expedia_Group_FT['Expedia_Group_Close'].tolist()))Expedia_Group_fft_df = pd.DataFrame({'Expedia_Group_final_fft':Expedia_Group_Close_fft})Expedia_Group_fft_df['Expedia_Group_fft_absolute'] = Expedia_Group_fft_df['Expedia_Group_final_fft'].apply(lambda x: np.abs(x))Expedia_Group_fft_df['Expedia_Group_fft_angle'] = Expedia_Group_fft_df['Expedia_Group_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Expedia_Group_fft_list = np.asarray(Expedia_Group_fft_df['Expedia_Group_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Expedia_Group_fft_list_m10= np.copy(Expedia_Group_fft_list); Expedia_Group_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Expedia_Group_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Expedia_Group_FT['Expedia_Group_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Expedia_Group (close) stock prices & Fourier transforms')plt.legend()plt.show()#Foot_Locker_FFTFoot_Locker_FT = SP500_TechIndicator[['Date', 'Foot_Locker_Close']]Foot_Locker_Close_fft = np.fft.fft(np.asarray(Foot_Locker_FT['Foot_Locker_Close'].tolist()))Foot_Locker_fft_df = pd.DataFrame({'Foot_Locker_final_fft':Foot_Locker_Close_fft})Foot_Locker_fft_df['Foot_Locker_fft_absolute'] = Foot_Locker_fft_df['Foot_Locker_final_fft'].apply(lambda x: np.abs(x))Foot_Locker_fft_df['Foot_Locker_fft_angle'] = Foot_Locker_fft_df['Foot_Locker_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Foot_Locker_fft_list = np.asarray(Foot_Locker_fft_df['Foot_Locker_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Foot_Locker_fft_list_m10= np.copy(Foot_Locker_fft_list); Foot_Locker_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Foot_Locker_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Foot_Locker_FT['Foot_Locker_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Foot_Locker (close) stock prices & Fourier transforms')plt.legend()plt.show()#Ford_Motor_FFTFord_Motor_FT = SP500_TechIndicator[['Date', 'Ford_Motor_Close']]Ford_Motor_Close_fft = np.fft.fft(np.asarray(Ford_Motor_FT['Ford_Motor_Close'].tolist()))Ford_Motor_fft_df = pd.DataFrame({'Ford_Motor_final_fft':Ford_Motor_Close_fft})Ford_Motor_fft_df['Ford_Motor_fft_absolute'] = Ford_Motor_fft_df['Ford_Motor_final_fft'].apply(lambda x: np.abs(x))Ford_Motor_fft_df['Ford_Motor_fft_angle'] = Ford_Motor_fft_df['Ford_Motor_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Ford_Motor_fft_list = np.asarray(Ford_Motor_fft_df['Ford_Motor_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Ford_Motor_fft_list_m10= np.copy(Ford_Motor_fft_list); Ford_Motor_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Ford_Motor_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Ford_Motor_FT['Ford_Motor_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Ford_Motor (close) stock prices & Fourier transforms')plt.legend()plt.show()#Gap_FFTGap_FT = SP500_TechIndicator[['Date', 'Gap_Close']]Gap_Close_fft = np.fft.fft(np.asarray(Gap_FT['Gap_Close'].tolist()))Gap_fft_df = pd.DataFrame({'Gap_final_fft':Gap_Close_fft})Gap_fft_df['Gap_fft_absolute'] = Gap_fft_df['Gap_final_fft'].apply(lambda x: np.abs(x))Gap_fft_df['Gap_fft_angle'] = Gap_fft_df['Gap_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Gap_fft_list = np.asarray(Gap_fft_df['Gap_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Gap_fft_list_m10= np.copy(Gap_fft_list); Gap_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Gap_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Gap_FT['Gap_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Gap (close) stock prices & Fourier transforms')plt.legend()plt.show()#Garmin_FFTGarmin_FT = SP500_TechIndicator[['Date', 'Garmin_Close']]Garmin_Close_fft = np.fft.fft(np.asarray(Garmin_FT['Garmin_Close'].tolist()))Garmin_fft_df = pd.DataFrame({'Garmin_final_fft':Garmin_Close_fft})Garmin_fft_df['Garmin_fft_absolute'] = Garmin_fft_df['Garmin_final_fft'].apply(lambda x: np.abs(x))Garmin_fft_df['Garmin_fft_angle'] = Garmin_fft_df['Garmin_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Garmin_fft_list = np.asarray(Garmin_fft_df['Garmin_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Garmin_fft_list_m10= np.copy(Garmin_fft_list); Garmin_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Garmin_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Garmin_FT['Garmin_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Garmin (close) stock prices & Fourier transforms')plt.legend()plt.show()#General_Motors_FFTGeneral_Motors_FT = SP500_TechIndicator[['Date', 'General_Motors_Close']]General_Motors_Close_fft = np.fft.fft(np.asarray(General_Motors_FT['General_Motors_Close'].tolist()))General_Motors_fft_df = pd.DataFrame({'General_Motors_final_fft':General_Motors_Close_fft})General_Motors_fft_df['General_Motors_fft_absolute'] = General_Motors_fft_df['General_Motors_final_fft'].apply(lambda x: np.abs(x))General_Motors_fft_df['General_Motors_fft_angle'] = General_Motors_fft_df['General_Motors_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)General_Motors_fft_list = np.asarray(General_Motors_fft_df['General_Motors_final_fft'].tolist())for num_ in [3, 6, 9, 100]: General_Motors_fft_list_m10= np.copy(General_Motors_fft_list); General_Motors_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(General_Motors_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(General_Motors_FT['General_Motors_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: General_Motors (close) stock prices & Fourier transforms')plt.legend()plt.show()#Genuine_Parts_FFTGenuine_Parts_FT = SP500_TechIndicator[['Date', 'Genuine_Parts_Close']]Genuine_Parts_Close_fft = np.fft.fft(np.asarray(Genuine_Parts_FT['Genuine_Parts_Close'].tolist()))Genuine_Parts_fft_df = pd.DataFrame({'Genuine_Parts_final_fft':Genuine_Parts_Close_fft})Genuine_Parts_fft_df['Genuine_Parts_fft_absolute'] = Genuine_Parts_fft_df['Genuine_Parts_final_fft'].apply(lambda x: np.abs(x))Genuine_Parts_fft_df['Genuine_Parts_fft_angle'] = Genuine_Parts_fft_df['Genuine_Parts_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Genuine_Parts_fft_list = np.asarray(Genuine_Parts_fft_df['Genuine_Parts_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Genuine_Parts_fft_list_m10= np.copy(Genuine_Parts_fft_list); Genuine_Parts_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Genuine_Parts_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Genuine_Parts_FT['Genuine_Parts_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Genuine_Parts (close) stock prices & Fourier transforms')plt.legend()plt.show()#Goodyear_Tire_Rubber_FFTGoodyear_Tire_Rubber_FT = SP500_TechIndicator[['Date', 'Goodyear_Tire_Rubber_Close']]Goodyear_Tire_Rubber_Close_fft = np.fft.fft(np.asarray(Goodyear_Tire_Rubber_FT['Goodyear_Tire_Rubber_Close'].tolist()))Goodyear_Tire_Rubber_fft_df = pd.DataFrame({'Goodyear_Tire_Rubber_final_fft':Goodyear_Tire_Rubber_Close_fft})Goodyear_Tire_Rubber_fft_df['Goodyear_Tire_Rubber_fft_absolute'] = Goodyear_Tire_Rubber_fft_df['Goodyear_Tire_Rubber_final_fft'].apply(lambda x: np.abs(x))Goodyear_Tire_Rubber_fft_df['Goodyear_Tire_Rubber_fft_angle'] = Goodyear_Tire_Rubber_fft_df['Goodyear_Tire_Rubber_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Goodyear_Tire_Rubber_fft_list = np.asarray(Goodyear_Tire_Rubber_fft_df['Goodyear_Tire_Rubber_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Goodyear_Tire_Rubber_fft_list_m10= np.copy(Goodyear_Tire_Rubber_fft_list); Goodyear_Tire_Rubber_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Goodyear_Tire_Rubber_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Goodyear_Tire_Rubber_FT['Goodyear_Tire_Rubber_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Goodyear_Tire_Rubber (close) stock prices & Fourier transforms')plt.legend()plt.show()#Hanesbrands_FFTHanesbrands_FT = SP500_TechIndicator[['Date', 'Hanesbrands_Close']]Hanesbrands_Close_fft = np.fft.fft(np.asarray(Hanesbrands_FT['Hanesbrands_Close'].tolist()))Hanesbrands_fft_df = pd.DataFrame({'Hanesbrands_final_fft':Hanesbrands_Close_fft})Hanesbrands_fft_df['Hanesbrands_fft_absolute'] = Hanesbrands_fft_df['Hanesbrands_final_fft'].apply(lambda x: np.abs(x))Hanesbrands_fft_df['Hanesbrands_fft_angle'] = Hanesbrands_fft_df['Hanesbrands_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Hanesbrands_fft_list = np.asarray(Hanesbrands_fft_df['Hanesbrands_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Hanesbrands_fft_list_m10= np.copy(Hanesbrands_fft_list); Hanesbrands_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Hanesbrands_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Hanesbrands_FT['Hanesbrands_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Hanesbrands (close) stock prices & Fourier transforms')plt.legend()plt.show()#Harley_Davidson_FFTHarley_Davidson_FT = SP500_TechIndicator[['Date', 'Harley_Davidson_Close']]Harley_Davidson_Close_fft = np.fft.fft(np.asarray(Harley_Davidson_FT['Harley_Davidson_Close'].tolist()))Harley_Davidson_fft_df = pd.DataFrame({'Harley_Davidson_final_fft':Harley_Davidson_Close_fft})Harley_Davidson_fft_df['Harley_Davidson_fft_absolute'] = Harley_Davidson_fft_df['Harley_Davidson_final_fft'].apply(lambda x: np.abs(x))Harley_Davidson_fft_df['Harley_Davidson_fft_angle'] = Harley_Davidson_fft_df['Harley_Davidson_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Harley_Davidson_fft_list = np.asarray(Harley_Davidson_fft_df['Harley_Davidson_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Harley_Davidson_fft_list_m10= np.copy(Harley_Davidson_fft_list); Harley_Davidson_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Harley_Davidson_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Harley_Davidson_FT['Harley_Davidson_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Harley_Davidson (close) stock prices & Fourier transforms')plt.legend()plt.show()#Hasbro_FFTHasbro_FT = SP500_TechIndicator[['Date', 'Hasbro_Close']]Hasbro_Close_fft = np.fft.fft(np.asarray(Hasbro_FT['Hasbro_Close'].tolist()))Hasbro_fft_df = pd.DataFrame({'Hasbro_final_fft':Hasbro_Close_fft})Hasbro_fft_df['Hasbro_fft_absolute'] = Hasbro_fft_df['Hasbro_final_fft'].apply(lambda x: np.abs(x))Hasbro_fft_df['Hasbro_fft_angle'] = Hasbro_fft_df['Hasbro_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Hasbro_fft_list = np.asarray(Hasbro_fft_df['Hasbro_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Hasbro_fft_list_m10= np.copy(Hasbro_fft_list); Hasbro_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Hasbro_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Hasbro_FT['Hasbro_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Hasbro (close) stock prices & Fourier transforms')plt.legend()plt.show()#Home_Depot_FFTHome_Depot_FT = SP500_TechIndicator[['Date', 'Home_Depot_Close']]Home_Depot_Close_fft = np.fft.fft(np.asarray(Home_Depot_FT['Home_Depot_Close'].tolist()))Home_Depot_fft_df = pd.DataFrame({'Home_Depot_final_fft':Home_Depot_Close_fft})Home_Depot_fft_df['Home_Depot_fft_absolute'] = Home_Depot_fft_df['Home_Depot_final_fft'].apply(lambda x: np.abs(x))Home_Depot_fft_df['Home_Depot_fft_angle'] = Home_Depot_fft_df['Home_Depot_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Home_Depot_fft_list = np.asarray(Home_Depot_fft_df['Home_Depot_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Home_Depot_fft_list_m10= np.copy(Home_Depot_fft_list); Home_Depot_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Home_Depot_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Home_Depot_FT['Home_Depot_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Home_Depot (close) stock prices & Fourier transforms')plt.legend()plt.show()#Kohls_FFTKohls_FT = SP500_TechIndicator[['Date', 'Kohls_Close']]Kohls_Close_fft = np.fft.fft(np.asarray(Kohls_FT['Kohls_Close'].tolist()))Kohls_fft_df = pd.DataFrame({'Kohls_final_fft':Kohls_Close_fft})Kohls_fft_df['Kohls_fft_absolute'] = Kohls_fft_df['Kohls_final_fft'].apply(lambda x: np.abs(x))Kohls_fft_df['Kohls_fft_angle'] = Kohls_fft_df['Kohls_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Kohls_fft_list = np.asarray(Kohls_fft_df['Kohls_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Kohls_fft_list_m10= np.copy(Kohls_fft_list); Kohls_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Kohls_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Kohls_FT['Kohls_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Kohls (close) stock prices & Fourier transforms')plt.legend()plt.show()#L_Brands_FFTL_Brands_FT = SP500_TechIndicator[['Date', 'L_Brands_Close']]L_Brands_Close_fft = np.fft.fft(np.asarray(L_Brands_FT['L_Brands_Close'].tolist()))L_Brands_fft_df = pd.DataFrame({'L_Brands_final_fft':L_Brands_Close_fft})L_Brands_fft_df['L_Brands_fft_absolute'] = L_Brands_fft_df['L_Brands_final_fft'].apply(lambda x: np.abs(x))L_Brands_fft_df['L_Brands_fft_angle'] = L_Brands_fft_df['L_Brands_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)L_Brands_fft_list = np.asarray(L_Brands_fft_df['L_Brands_final_fft'].tolist())for num_ in [3, 6, 9, 100]: L_Brands_fft_list_m10= np.copy(L_Brands_fft_list); L_Brands_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(L_Brands_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(L_Brands_FT['L_Brands_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: L_Brands (close) stock prices & Fourier transforms')plt.legend()plt.show()#Leggett_Platt_FFTLeggett_Platt_FT = SP500_TechIndicator[['Date', 'Leggett_Platt_Close']]Leggett_Platt_Close_fft = np.fft.fft(np.asarray(Leggett_Platt_FT['Leggett_Platt_Close'].tolist()))Leggett_Platt_fft_df = pd.DataFrame({'Leggett_Platt_final_fft':Leggett_Platt_Close_fft})Leggett_Platt_fft_df['Leggett_Platt_fft_absolute'] = Leggett_Platt_fft_df['Leggett_Platt_final_fft'].apply(lambda x: np.abs(x))Leggett_Platt_fft_df['Leggett_Platt_fft_angle'] = Leggett_Platt_fft_df['Leggett_Platt_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Leggett_Platt_fft_list = np.asarray(Leggett_Platt_fft_df['Leggett_Platt_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Leggett_Platt_fft_list_m10= np.copy(Leggett_Platt_fft_list); Leggett_Platt_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Leggett_Platt_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Leggett_Platt_FT['Leggett_Platt_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Leggett_Platt (close) stock prices & Fourier transforms')plt.legend()plt.show()#Lennar_FFTLennar_FT = SP500_TechIndicator[['Date', 'Lennar_Close']]Lennar_Close_fft = np.fft.fft(np.asarray(Lennar_FT['Lennar_Close'].tolist()))Lennar_fft_df = pd.DataFrame({'Lennar_final_fft':Lennar_Close_fft})Lennar_fft_df['Lennar_fft_absolute'] = Lennar_fft_df['Lennar_final_fft'].apply(lambda x: np.abs(x))Lennar_fft_df['Lennar_fft_angle'] = Lennar_fft_df['Lennar_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Lennar_fft_list = np.asarray(Lennar_fft_df['Lennar_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Lennar_fft_list_m10= np.copy(Lennar_fft_list); Lennar_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Lennar_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Lennar_FT['Lennar_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Lennar (close) stock prices & Fourier transforms')plt.legend()plt.show()#LKQ_FFTLKQ_FT = SP500_TechIndicator[['Date', 'LKQ_Close']]LKQ_Close_fft = np.fft.fft(np.asarray(LKQ_FT['LKQ_Close'].tolist()))LKQ_fft_df = pd.DataFrame({'LKQ_final_fft':LKQ_Close_fft})LKQ_fft_df['LKQ_fft_absolute'] = LKQ_fft_df['LKQ_final_fft'].apply(lambda x: np.abs(x))LKQ_fft_df['LKQ_fft_angle'] = LKQ_fft_df['LKQ_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)LKQ_fft_list = np.asarray(LKQ_fft_df['LKQ_final_fft'].tolist())for num_ in [3, 6, 9, 100]: LKQ_fft_list_m10= np.copy(LKQ_fft_list); LKQ_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(LKQ_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(LKQ_FT['LKQ_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: LKQ (close) stock prices & Fourier transforms')plt.legend()plt.show()#Lowes_Cos_FFTLowes_Cos_FT = SP500_TechIndicator[['Date', 'Lowes_Cos_Close']]Lowes_Cos_Close_fft = np.fft.fft(np.asarray(Lowes_Cos_FT['Lowes_Cos_Close'].tolist()))Lowes_Cos_fft_df = pd.DataFrame({'Lowes_Cos_final_fft':Lowes_Cos_Close_fft})Lowes_Cos_fft_df['Lowes_Cos_fft_absolute'] = Lowes_Cos_fft_df['Lowes_Cos_final_fft'].apply(lambda x: np.abs(x))Lowes_Cos_fft_df['Lowes_Cos_fft_angle'] = Lowes_Cos_fft_df['Lowes_Cos_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Lowes_Cos_fft_list = np.asarray(Lowes_Cos_fft_df['Lowes_Cos_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Lowes_Cos_fft_list_m10= np.copy(Lowes_Cos_fft_list); Lowes_Cos_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Lowes_Cos_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Lowes_Cos_FT['Lowes_Cos_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Lowes_Cos (close) stock prices & Fourier transforms')plt.legend()plt.show()#Macys_FFTMacys_FT = SP500_TechIndicator[['Date', 'Macys_Close']]Macys_Close_fft = np.fft.fft(np.asarray(Macys_FT['Macys_Close'].tolist()))Macys_fft_df = pd.DataFrame({'Macys_final_fft':Macys_Close_fft})Macys_fft_df['Macys_fft_absolute'] = Macys_fft_df['Macys_final_fft'].apply(lambda x: np.abs(x))Macys_fft_df['Macys_fft_angle'] = Macys_fft_df['Macys_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Macys_fft_list = np.asarray(Macys_fft_df['Macys_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Macys_fft_list_m10= np.copy(Macys_fft_list); Macys_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Macys_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Macys_FT['Macys_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Macys (close) stock prices & Fourier transforms')plt.legend()plt.show()#Marriott_Int_FFTMarriott_Int_FT = SP500_TechIndicator[['Date', 'Marriott_Int_Close']]Marriott_Int_Close_fft = np.fft.fft(np.asarray(Marriott_Int_FT['Marriott_Int_Close'].tolist()))Marriott_Int_fft_df = pd.DataFrame({'Marriott_Int_final_fft':Marriott_Int_Close_fft})Marriott_Int_fft_df['Marriott_Int_fft_absolute'] = Marriott_Int_fft_df['Marriott_Int_final_fft'].apply(lambda x: np.abs(x))Marriott_Int_fft_df['Marriott_Int_fft_angle'] = Marriott_Int_fft_df['Marriott_Int_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Marriott_Int_fft_list = np.asarray(Marriott_Int_fft_df['Marriott_Int_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Marriott_Int_fft_list_m10= np.copy(Marriott_Int_fft_list); Marriott_Int_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Marriott_Int_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Marriott_Int_FT['Marriott_Int_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Marriott_Int (close) stock prices & Fourier transforms')plt.legend()plt.show()#Mattel_FFTMattel_FT = SP500_TechIndicator[['Date', 'Mattel_Close']]Mattel_Close_fft = np.fft.fft(np.asarray(Mattel_FT['Mattel_Close'].tolist()))Mattel_fft_df = pd.DataFrame({'Mattel_final_fft':Mattel_Close_fft})Mattel_fft_df['Mattel_fft_absolute'] = Mattel_fft_df['Mattel_final_fft'].apply(lambda x: np.abs(x))Mattel_fft_df['Mattel_fft_angle'] = Mattel_fft_df['Mattel_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Mattel_fft_list = np.asarray(Mattel_fft_df['Mattel_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Mattel_fft_list_m10= np.copy(Mattel_fft_list); Mattel_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Mattel_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Mattel_FT['Mattel_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Mattel (close) stock prices & Fourier transforms')plt.legend()plt.show()#McDonalds_FFTMcDonalds_FT = SP500_TechIndicator[['Date', 'McDonalds_Close']]McDonalds_Close_fft = np.fft.fft(np.asarray(McDonalds_FT['McDonalds_Close'].tolist()))McDonalds_fft_df = pd.DataFrame({'McDonalds_final_fft':McDonalds_Close_fft})McDonalds_fft_df['McDonalds_fft_absolute'] = McDonalds_fft_df['McDonalds_final_fft'].apply(lambda x: np.abs(x))McDonalds_fft_df['McDonalds_fft_angle'] = McDonalds_fft_df['McDonalds_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)McDonalds_fft_list = np.asarray(McDonalds_fft_df['McDonalds_final_fft'].tolist())for num_ in [3, 6, 9, 100]: McDonalds_fft_list_m10= np.copy(McDonalds_fft_list); McDonalds_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(McDonalds_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(McDonalds_FT['McDonalds_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: McDonalds (close) stock prices & Fourier transforms')plt.legend()plt.show()#MGM_Resorts_International_FFTMGM_Resorts_International_FT = SP500_TechIndicator[['Date', 'MGM_Resorts_International_Close']]MGM_Resorts_International_Close_fft = np.fft.fft(np.asarray(MGM_Resorts_International_FT['MGM_Resorts_International_Close'].tolist()))MGM_Resorts_International_fft_df = pd.DataFrame({'MGM_Resorts_International_final_fft':MGM_Resorts_International_Close_fft})MGM_Resorts_International_fft_df['MGM_Resorts_International_fft_absolute'] = MGM_Resorts_International_fft_df['MGM_Resorts_International_final_fft'].apply(lambda x: np.abs(x))MGM_Resorts_International_fft_df['MGM_Resorts_International_fft_angle'] = MGM_Resorts_International_fft_df['MGM_Resorts_International_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)MGM_Resorts_International_fft_list = np.asarray(MGM_Resorts_International_fft_df['MGM_Resorts_International_final_fft'].tolist())for num_ in [3, 6, 9, 100]: MGM_Resorts_International_fft_list_m10= np.copy(MGM_Resorts_International_fft_list); MGM_Resorts_International_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(MGM_Resorts_International_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(MGM_Resorts_International_FT['MGM_Resorts_International_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: MGM_Resorts_International (close) stock prices & Fourier transforms')plt.legend()plt.show()#Mohawk_Industries_FFTMohawk_Industries_FT = SP500_TechIndicator[['Date', 'Mohawk_Industries_Close']]Mohawk_Industries_Close_fft = np.fft.fft(np.asarray(Mohawk_Industries_FT['Mohawk_Industries_Close'].tolist()))Mohawk_Industries_fft_df = pd.DataFrame({'Mohawk_Industries_final_fft':Mohawk_Industries_Close_fft})Mohawk_Industries_fft_df['Mohawk_Industries_fft_absolute'] = Mohawk_Industries_fft_df['Mohawk_Industries_final_fft'].apply(lambda x: np.abs(x))Mohawk_Industries_fft_df['Mohawk_Industries_fft_angle'] = Mohawk_Industries_fft_df['Mohawk_Industries_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Mohawk_Industries_fft_list = np.asarray(Mohawk_Industries_fft_df['Mohawk_Industries_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Mohawk_Industries_fft_list_m10= np.copy(Mohawk_Industries_fft_list); Mohawk_Industries_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Mohawk_Industries_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Mohawk_Industries_FT['Mohawk_Industries_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Mohawk_Industries (close) stock prices & Fourier transforms')plt.legend()plt.show()#Newell_Brands_FFTNewell_Brands_FT = SP500_TechIndicator[['Date', 'Newell_Brands_Close']]Newell_Brands_Close_fft = np.fft.fft(np.asarray(Newell_Brands_FT['Newell_Brands_Close'].tolist()))Newell_Brands_fft_df = pd.DataFrame({'Newell_Brands_final_fft':Newell_Brands_Close_fft})Newell_Brands_fft_df['Newell_Brands_fft_absolute'] = Newell_Brands_fft_df['Newell_Brands_final_fft'].apply(lambda x: np.abs(x))Newell_Brands_fft_df['Newell_Brands_fft_angle'] = Newell_Brands_fft_df['Newell_Brands_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Newell_Brands_fft_list = np.asarray(Newell_Brands_fft_df['Newell_Brands_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Newell_Brands_fft_list_m10= np.copy(Newell_Brands_fft_list); Newell_Brands_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Newell_Brands_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Newell_Brands_FT['Newell_Brands_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Newell_Brands (close) stock prices & Fourier transforms')plt.legend()plt.show()#Nike_FFTNike_FT = SP500_TechIndicator[['Date', 'Nike_Close']]Nike_Close_fft = np.fft.fft(np.asarray(Nike_FT['Nike_Close'].tolist()))Nike_fft_df = pd.DataFrame({'Nike_final_fft':Nike_Close_fft})Nike_fft_df['Nike_fft_absolute'] = Nike_fft_df['Nike_final_fft'].apply(lambda x: np.abs(x))Nike_fft_df['Nike_fft_angle'] = Nike_fft_df['Nike_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Nike_fft_list = np.asarray(Nike_fft_df['Nike_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Nike_fft_list_m10= np.copy(Nike_fft_list); Nike_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Nike_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Nike_FT['Nike_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Nike (close) stock prices & Fourier transforms')plt.legend()plt.show()#Nordstrom_FFTNordstrom_FT = SP500_TechIndicator[['Date', 'Nordstrom_Close']]Nordstrom_Close_fft = np.fft.fft(np.asarray(Nordstrom_FT['Nordstrom_Close'].tolist()))Nordstrom_fft_df = pd.DataFrame({'Nordstrom_final_fft':Nordstrom_Close_fft})Nordstrom_fft_df['Nordstrom_fft_absolute'] = Nordstrom_fft_df['Nordstrom_final_fft'].apply(lambda x: np.abs(x))Nordstrom_fft_df['Nordstrom_fft_angle'] = Nordstrom_fft_df['Nordstrom_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Nordstrom_fft_list = np.asarray(Nordstrom_fft_df['Nordstrom_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Nordstrom_fft_list_m10= np.copy(Nordstrom_fft_list); Nordstrom_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Nordstrom_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Nordstrom_FT['Nordstrom_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Nordstrom (close) stock prices & Fourier transforms')plt.legend()plt.show()#Norwegian_Cruise_Line_FFTNorwegian_Cruise_Line_FT = SP500_TechIndicator[['Date', 'Norwegian_Cruise_Line_Close']]Norwegian_Cruise_Line_Close_fft = np.fft.fft(np.asarray(Norwegian_Cruise_Line_FT['Norwegian_Cruise_Line_Close'].tolist()))Norwegian_Cruise_Line_fft_df = pd.DataFrame({'Norwegian_Cruise_Line_final_fft':Norwegian_Cruise_Line_Close_fft})Norwegian_Cruise_Line_fft_df['Norwegian_Cruise_Line_fft_absolute'] = Norwegian_Cruise_Line_fft_df['Norwegian_Cruise_Line_final_fft'].apply(lambda x: np.abs(x))Norwegian_Cruise_Line_fft_df['Norwegian_Cruise_Line_fft_angle'] = Norwegian_Cruise_Line_fft_df['Norwegian_Cruise_Line_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Norwegian_Cruise_Line_fft_list = np.asarray(Norwegian_Cruise_Line_fft_df['Norwegian_Cruise_Line_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Norwegian_Cruise_Line_fft_list_m10= np.copy(Norwegian_Cruise_Line_fft_list); Norwegian_Cruise_Line_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Norwegian_Cruise_Line_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Norwegian_Cruise_Line_FT['Norwegian_Cruise_Line_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Norwegian_Cruise_Line (close) stock prices & Fourier transforms')plt.legend()plt.show()#OReilly_Automotive_FFTOReilly_Automotive_FT = SP500_TechIndicator[['Date', 'OReilly_Automotive_Close']]OReilly_Automotive_Close_fft = np.fft.fft(np.asarray(OReilly_Automotive_FT['OReilly_Automotive_Close'].tolist()))OReilly_Automotive_fft_df = pd.DataFrame({'OReilly_Automotive_final_fft':OReilly_Automotive_Close_fft})OReilly_Automotive_fft_df['OReilly_Automotive_fft_absolute'] = OReilly_Automotive_fft_df['OReilly_Automotive_final_fft'].apply(lambda x: np.abs(x))OReilly_Automotive_fft_df['OReilly_Automotive_fft_angle'] = OReilly_Automotive_fft_df['OReilly_Automotive_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)OReilly_Automotive_fft_list = np.asarray(OReilly_Automotive_fft_df['OReilly_Automotive_final_fft'].tolist())for num_ in [3, 6, 9, 100]: OReilly_Automotive_fft_list_m10= np.copy(OReilly_Automotive_fft_list); OReilly_Automotive_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(OReilly_Automotive_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(OReilly_Automotive_FT['OReilly_Automotive_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: OReilly_Automotive (close) stock prices & Fourier transforms')plt.legend()plt.show()#Polo_Ralph_Lauren_FFTPolo_Ralph_Lauren_FT = SP500_TechIndicator[['Date', 'Polo_Ralph_Lauren_Close']]Polo_Ralph_Lauren_Close_fft = np.fft.fft(np.asarray(Polo_Ralph_Lauren_FT['Polo_Ralph_Lauren_Close'].tolist()))Polo_Ralph_Lauren_fft_df = pd.DataFrame({'Polo_Ralph_Lauren_final_fft':Polo_Ralph_Lauren_Close_fft})Polo_Ralph_Lauren_fft_df['Polo_Ralph_Lauren_fft_absolute'] = Polo_Ralph_Lauren_fft_df['Polo_Ralph_Lauren_final_fft'].apply(lambda x: np.abs(x))Polo_Ralph_Lauren_fft_df['Polo_Ralph_Lauren_fft_angle'] = Polo_Ralph_Lauren_fft_df['Polo_Ralph_Lauren_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Polo_Ralph_Lauren_fft_list = np.asarray(Polo_Ralph_Lauren_fft_df['Polo_Ralph_Lauren_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Polo_Ralph_Lauren_fft_list_m10= np.copy(Polo_Ralph_Lauren_fft_list); Polo_Ralph_Lauren_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Polo_Ralph_Lauren_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Polo_Ralph_Lauren_FT['Polo_Ralph_Lauren_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Polo_Ralph_Lauren (close) stock prices & Fourier transforms')plt.legend()plt.show()#Pulte_Homes_FFTPulte_Homes_FT = SP500_TechIndicator[['Date', 'Pulte_Homes_Close']]Pulte_Homes_Close_fft = np.fft.fft(np.asarray(Pulte_Homes_FT['Pulte_Homes_Close'].tolist()))Pulte_Homes_fft_df = pd.DataFrame({'Pulte_Homes_final_fft':Pulte_Homes_Close_fft})Pulte_Homes_fft_df['Pulte_Homes_fft_absolute'] = Pulte_Homes_fft_df['Pulte_Homes_final_fft'].apply(lambda x: np.abs(x))Pulte_Homes_fft_df['Pulte_Homes_fft_angle'] = Pulte_Homes_fft_df['Pulte_Homes_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Pulte_Homes_fft_list = np.asarray(Pulte_Homes_fft_df['Pulte_Homes_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Pulte_Homes_fft_list_m10= np.copy(Pulte_Homes_fft_list); Pulte_Homes_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Pulte_Homes_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Pulte_Homes_FT['Pulte_Homes_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Pulte_Homes (close) stock prices & Fourier transforms')plt.legend()plt.show()#PVH_Corp_FFTPVH_Corp_FT = SP500_TechIndicator[['Date', 'PVH_Corp_Close']]PVH_Corp_Close_fft = np.fft.fft(np.asarray(PVH_Corp_FT['PVH_Corp_Close'].tolist()))PVH_Corp_fft_df = pd.DataFrame({'PVH_Corp_final_fft':PVH_Corp_Close_fft})PVH_Corp_fft_df['PVH_Corp_fft_absolute'] = PVH_Corp_fft_df['PVH_Corp_final_fft'].apply(lambda x: np.abs(x))PVH_Corp_fft_df['PVH_Corp_fft_angle'] = PVH_Corp_fft_df['PVH_Corp_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)PVH_Corp_fft_list = np.asarray(PVH_Corp_fft_df['PVH_Corp_final_fft'].tolist())for num_ in [3, 6, 9, 100]: PVH_Corp_fft_list_m10= np.copy(PVH_Corp_fft_list); PVH_Corp_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(PVH_Corp_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(PVH_Corp_FT['PVH_Corp_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: PVH_Corp (close) stock prices & Fourier transforms')plt.legend()plt.show()#Ross_Stores_FFTRoss_Stores_FT = SP500_TechIndicator[['Date', 'Ross_Stores_Close']]Ross_Stores_Close_fft = np.fft.fft(np.asarray(Ross_Stores_FT['Ross_Stores_Close'].tolist()))Ross_Stores_fft_df = pd.DataFrame({'Ross_Stores_final_fft':Ross_Stores_Close_fft})Ross_Stores_fft_df['Ross_Stores_fft_absolute'] = Ross_Stores_fft_df['Ross_Stores_final_fft'].apply(lambda x: np.abs(x))Ross_Stores_fft_df['Ross_Stores_fft_angle'] = Ross_Stores_fft_df['Ross_Stores_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Ross_Stores_fft_list = np.asarray(Ross_Stores_fft_df['Ross_Stores_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Ross_Stores_fft_list_m10= np.copy(Ross_Stores_fft_list); Ross_Stores_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Ross_Stores_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Ross_Stores_FT['Ross_Stores_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Ross_Stores (close) stock prices & Fourier transforms')plt.legend()plt.show()#Starbucks_FFTStarbucks_FT = SP500_TechIndicator[['Date', 'Starbucks_Close']]Starbucks_Close_fft = np.fft.fft(np.asarray(Starbucks_FT['Starbucks_Close'].tolist()))Starbucks_fft_df = pd.DataFrame({'Starbucks_final_fft':Starbucks_Close_fft})Starbucks_fft_df['Starbucks_fft_absolute'] = Starbucks_fft_df['Starbucks_final_fft'].apply(lambda x: np.abs(x))Starbucks_fft_df['Starbucks_fft_angle'] = Starbucks_fft_df['Starbucks_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Starbucks_fft_list = np.asarray(Starbucks_fft_df['Starbucks_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Starbucks_fft_list_m10= np.copy(Starbucks_fft_list); Starbucks_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Starbucks_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Starbucks_FT['Starbucks_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Starbucks (close) stock prices & Fourier transforms')plt.legend()plt.show()#Target_FFTTarget_FT = SP500_TechIndicator[['Date', 'Target_Close']]Target_Close_fft = np.fft.fft(np.asarray(Target_FT['Target_Close'].tolist()))Target_fft_df = pd.DataFrame({'Target_final_fft':Target_Close_fft})Target_fft_df['Target_fft_absolute'] = Target_fft_df['Target_final_fft'].apply(lambda x: np.abs(x))Target_fft_df['Target_fft_angle'] = Target_fft_df['Target_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Target_fft_list = np.asarray(Target_fft_df['Target_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Target_fft_list_m10= np.copy(Target_fft_list); Target_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Target_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Target_FT['Target_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Target (close) stock prices & Fourier transforms')plt.legend()plt.show()#Tiffany_FFTTiffany_FT = SP500_TechIndicator[['Date', 'Tiffany_Close']]Tiffany_Close_fft = np.fft.fft(np.asarray(Tiffany_FT['Tiffany_Close'].tolist()))Tiffany_fft_df = pd.DataFrame({'Tiffany_final_fft':Tiffany_Close_fft})Tiffany_fft_df['Tiffany_fft_absolute'] = Tiffany_fft_df['Tiffany_final_fft'].apply(lambda x: np.abs(x))Tiffany_fft_df['Tiffany_fft_angle'] = Tiffany_fft_df['Tiffany_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Tiffany_fft_list = np.asarray(Tiffany_fft_df['Tiffany_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Tiffany_fft_list_m10= np.copy(Tiffany_fft_list); Tiffany_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Tiffany_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Tiffany_FT['Tiffany_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Tiffany (close) stock prices & Fourier transforms')plt.legend()plt.show()#TJX_Companies_FFTTJX_Companies_FT = SP500_TechIndicator[['Date', 'TJX_Companies_Close']]TJX_Companies_Close_fft = np.fft.fft(np.asarray(TJX_Companies_FT['TJX_Companies_Close'].tolist()))TJX_Companies_fft_df = pd.DataFrame({'TJX_Companies_final_fft':TJX_Companies_Close_fft})TJX_Companies_fft_df['TJX_Companies_fft_absolute'] = TJX_Companies_fft_df['TJX_Companies_final_fft'].apply(lambda x: np.abs(x))TJX_Companies_fft_df['TJX_Companies_fft_angle'] = TJX_Companies_fft_df['TJX_Companies_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)TJX_Companies_fft_list = np.asarray(TJX_Companies_fft_df['TJX_Companies_final_fft'].tolist())for num_ in [3, 6, 9, 100]: TJX_Companies_fft_list_m10= np.copy(TJX_Companies_fft_list); TJX_Companies_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(TJX_Companies_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(TJX_Companies_FT['TJX_Companies_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: TJX_Companies (close) stock prices & Fourier transforms')plt.legend()plt.show()#Tractor_Supply_Company_FFTTractor_Supply_Company_FT = SP500_TechIndicator[['Date', 'Tractor_Supply_Company_Close']]Tractor_Supply_Company_Close_fft = np.fft.fft(np.asarray(Tractor_Supply_Company_FT['Tractor_Supply_Company_Close'].tolist()))Tractor_Supply_Company_fft_df = pd.DataFrame({'Tractor_Supply_Company_final_fft':Tractor_Supply_Company_Close_fft})Tractor_Supply_Company_fft_df['Tractor_Supply_Company_fft_absolute'] = Tractor_Supply_Company_fft_df['Tractor_Supply_Company_final_fft'].apply(lambda x: np.abs(x))Tractor_Supply_Company_fft_df['Tractor_Supply_Company_fft_angle'] = Tractor_Supply_Company_fft_df['Tractor_Supply_Company_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Tractor_Supply_Company_fft_list = np.asarray(Tractor_Supply_Company_fft_df['Tractor_Supply_Company_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Tractor_Supply_Company_fft_list_m10= np.copy(Tractor_Supply_Company_fft_list); Tractor_Supply_Company_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Tractor_Supply_Company_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Tractor_Supply_Company_FT['Tractor_Supply_Company_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Tractor_Supply_Company (close) stock prices & Fourier transforms')plt.legend()plt.show()#Ulta_Beauty_FFTUlta_Beauty_FT = SP500_TechIndicator[['Date', 'Ulta_Beauty_Close']]Ulta_Beauty_Close_fft = np.fft.fft(np.asarray(Ulta_Beauty_FT['Ulta_Beauty_Close'].tolist()))Ulta_Beauty_fft_df = pd.DataFrame({'Ulta_Beauty_final_fft':Ulta_Beauty_Close_fft})Ulta_Beauty_fft_df['Ulta_Beauty_fft_absolute'] = Ulta_Beauty_fft_df['Ulta_Beauty_final_fft'].apply(lambda x: np.abs(x))Ulta_Beauty_fft_df['Ulta_Beauty_fft_angle'] = Ulta_Beauty_fft_df['Ulta_Beauty_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Ulta_Beauty_fft_list = np.asarray(Ulta_Beauty_fft_df['Ulta_Beauty_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Ulta_Beauty_fft_list_m10= np.copy(Ulta_Beauty_fft_list); Ulta_Beauty_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Ulta_Beauty_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Ulta_Beauty_FT['Ulta_Beauty_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Ulta_Beauty (close) stock prices & Fourier transforms')plt.legend()plt.show()#Under_Armour_Class_A_FFTUnder_Armour_Class_A_FT = SP500_TechIndicator[['Date', 'Under_Armour_Class_A_Close']]Under_Armour_Class_A_Close_fft = np.fft.fft(np.asarray(Under_Armour_Class_A_FT['Under_Armour_Class_A_Close'].tolist()))Under_Armour_Class_A_fft_df = pd.DataFrame({'Under_Armour_Class_A_final_fft':Under_Armour_Class_A_Close_fft})Under_Armour_Class_A_fft_df['Under_Armour_Class_A_fft_absolute'] = Under_Armour_Class_A_fft_df['Under_Armour_Class_A_final_fft'].apply(lambda x: np.abs(x))Under_Armour_Class_A_fft_df['Under_Armour_Class_A_fft_angle'] = Under_Armour_Class_A_fft_df['Under_Armour_Class_A_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Under_Armour_Class_A_fft_list = np.asarray(Under_Armour_Class_A_fft_df['Under_Armour_Class_A_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Under_Armour_Class_A_fft_list_m10= np.copy(Under_Armour_Class_A_fft_list); Under_Armour_Class_A_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Under_Armour_Class_A_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Under_Armour_Class_A_FT['Under_Armour_Class_A_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Under_Armour_Class_A (close) stock prices & Fourier transforms')plt.legend()plt.show()#V_F_Corp_FFTV_F_Corp_FT = SP500_TechIndicator[['Date', 'V_F_Corp_Close']]V_F_Corp_Close_fft = np.fft.fft(np.asarray(V_F_Corp_FT['V_F_Corp_Close'].tolist()))V_F_Corp_fft_df = pd.DataFrame({'V_F_Corp_final_fft':V_F_Corp_Close_fft})V_F_Corp_fft_df['V_F_Corp_fft_absolute'] = V_F_Corp_fft_df['V_F_Corp_final_fft'].apply(lambda x: np.abs(x))V_F_Corp_fft_df['V_F_Corp_fft_angle'] = V_F_Corp_fft_df['V_F_Corp_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)V_F_Corp_fft_list = np.asarray(V_F_Corp_fft_df['V_F_Corp_final_fft'].tolist())for num_ in [3, 6, 9, 100]: V_F_Corp_fft_list_m10= np.copy(V_F_Corp_fft_list); V_F_Corp_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(V_F_Corp_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(V_F_Corp_FT['V_F_Corp_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: V_F_Corp (close) stock prices & Fourier transforms')plt.legend()plt.show()#Whirlpool_FFTWhirlpool_FT = SP500_TechIndicator[['Date', 'Whirlpool_Close']]Whirlpool_Close_fft = np.fft.fft(np.asarray(Whirlpool_FT['Whirlpool_Close'].tolist()))Whirlpool_fft_df = pd.DataFrame({'Whirlpool_final_fft':Whirlpool_Close_fft})Whirlpool_fft_df['Whirlpool_fft_absolute'] = Whirlpool_fft_df['Whirlpool_final_fft'].apply(lambda x: np.abs(x))Whirlpool_fft_df['Whirlpool_fft_angle'] = Whirlpool_fft_df['Whirlpool_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Whirlpool_fft_list = np.asarray(Whirlpool_fft_df['Whirlpool_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Whirlpool_fft_list_m10= np.copy(Whirlpool_fft_list); Whirlpool_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Whirlpool_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Whirlpool_FT['Whirlpool_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Whirlpool (close) stock prices & Fourier transforms')plt.legend()plt.show()#Wynn_Resorts_FFTWynn_Resorts_FT = SP500_TechIndicator[['Date', 'Wynn_Resorts_Close']]Wynn_Resorts_Close_fft = np.fft.fft(np.asarray(Wynn_Resorts_FT['Wynn_Resorts_Close'].tolist()))Wynn_Resorts_fft_df = pd.DataFrame({'Wynn_Resorts_final_fft':Wynn_Resorts_Close_fft})Wynn_Resorts_fft_df['Wynn_Resorts_fft_absolute'] = Wynn_Resorts_fft_df['Wynn_Resorts_final_fft'].apply(lambda x: np.abs(x))Wynn_Resorts_fft_df['Wynn_Resorts_fft_angle'] = Wynn_Resorts_fft_df['Wynn_Resorts_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Wynn_Resorts_fft_list = np.asarray(Wynn_Resorts_fft_df['Wynn_Resorts_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Wynn_Resorts_fft_list_m10= np.copy(Wynn_Resorts_fft_list); Wynn_Resorts_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Wynn_Resorts_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Wynn_Resorts_FT['Wynn_Resorts_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Wynn_Resorts (close) stock prices & Fourier transforms')plt.legend()plt.show()#Yum_Brands_FFTYum_Brands_FT = SP500_TechIndicator[['Date', 'Yum_Brands_Close']]Yum_Brands_Close_fft = np.fft.fft(np.asarray(Yum_Brands_FT['Yum_Brands_Close'].tolist()))Yum_Brands_fft_df = pd.DataFrame({'Yum_Brands_final_fft':Yum_Brands_Close_fft})Yum_Brands_fft_df['Yum_Brands_fft_absolute'] = Yum_Brands_fft_df['Yum_Brands_final_fft'].apply(lambda x: np.abs(x))Yum_Brands_fft_df['Yum_Brands_fft_angle'] = Yum_Brands_fft_df['Yum_Brands_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Yum_Brands_fft_list = np.asarray(Yum_Brands_fft_df['Yum_Brands_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Yum_Brands_fft_list_m10= np.copy(Yum_Brands_fft_list); Yum_Brands_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Yum_Brands_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Yum_Brands_FT['Yum_Brands_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure 3: Yum_Brands (close) stock prices & Fourier transforms')plt.legend()plt.show()#Altria_Group_FFTAltria_Group_FT = SP500_TechIndicator[['Date', 'Altria_Group_Close']]Altria_Group_Close_fft = np.fft.fft(np.asarray(Altria_Group_FT['Altria_Group_Close'].tolist()))Altria_Group_fft_df = pd.DataFrame({'Altria_Group_final_fft':Altria_Group_Close_fft})Altria_Group_fft_df['Altria_Group_fft_absolute'] = Altria_Group_fft_df['Altria_Group_final_fft'].apply(lambda x: np.abs(x))Altria_Group_fft_df['Altria_Group_fft_angle'] = Altria_Group_fft_df['Altria_Group_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Altria_Group_fft_list = np.asarray(Altria_Group_fft_df['Altria_Group_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Altria_Group_fft_list_m10= np.copy(Altria_Group_fft_list); Altria_Group_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Altria_Group_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Altria_Group_FT['Altria_Group_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure : Altria_Group (close) stock prices & Fourier transforms')plt.legend()plt.show()#Archer_Daniels_Midland_Co_FFTArcher_Daniels_Midland_Co_FT = SP500_TechIndicator[['Date', 'Archer_Daniels_Midland_Co_Close']]Archer_Daniels_Midland_Co_Close_fft = np.fft.fft(np.asarray(Archer_Daniels_Midland_Co_FT['Archer_Daniels_Midland_Co_Close'].tolist()))Archer_Daniels_Midland_Co_fft_df = pd.DataFrame({'Archer_Daniels_Midland_Co_final_fft':Archer_Daniels_Midland_Co_Close_fft})Archer_Daniels_Midland_Co_fft_df['Archer_Daniels_Midland_Co_fft_absolute'] = Archer_Daniels_Midland_Co_fft_df['Archer_Daniels_Midland_Co_final_fft'].apply(lambda x: np.abs(x))Archer_Daniels_Midland_Co_fft_df['Archer_Daniels_Midland_Co_fft_angle'] = Archer_Daniels_Midland_Co_fft_df['Archer_Daniels_Midland_Co_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Archer_Daniels_Midland_Co_fft_list = np.asarray(Archer_Daniels_Midland_Co_fft_df['Archer_Daniels_Midland_Co_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Archer_Daniels_Midland_Co_fft_list_m10= np.copy(Archer_Daniels_Midland_Co_fft_list); Archer_Daniels_Midland_Co_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Archer_Daniels_Midland_Co_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Archer_Daniels_Midland_Co_FT['Archer_Daniels_Midland_Co_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Archer_Daniels_Midland_Co (close) stock prices & Fourier transforms')plt.legend()plt.show()#Brown_Forman_FFTBrown_Forman_FT = SP500_TechIndicator[['Date', 'Brown_Forman_Close']]Brown_Forman_Close_fft = np.fft.fft(np.asarray(Brown_Forman_FT['Brown_Forman_Close'].tolist()))Brown_Forman_fft_df = pd.DataFrame({'Brown_Forman_final_fft':Brown_Forman_Close_fft})Brown_Forman_fft_df['Brown_Forman_fft_absolute'] = Brown_Forman_fft_df['Brown_Forman_final_fft'].apply(lambda x: np.abs(x))Brown_Forman_fft_df['Brown_Forman_fft_angle'] = Brown_Forman_fft_df['Brown_Forman_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Brown_Forman_fft_list = np.asarray(Brown_Forman_fft_df['Brown_Forman_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Brown_Forman_fft_list_m10= np.copy(Brown_Forman_fft_list); Brown_Forman_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Brown_Forman_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Brown_Forman_FT['Brown_Forman_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Brown_Forman (close) stock prices & Fourier transforms')plt.legend()plt.show()#Campbell_Soup_FFTCampbell_Soup_FT = SP500_TechIndicator[['Date', 'Campbell_Soup_Close']]Campbell_Soup_Close_fft = np.fft.fft(np.asarray(Campbell_Soup_FT['Campbell_Soup_Close'].tolist()))Campbell_Soup_fft_df = pd.DataFrame({'Campbell_Soup_final_fft':Campbell_Soup_Close_fft})Campbell_Soup_fft_df['Campbell_Soup_fft_absolute'] = Campbell_Soup_fft_df['Campbell_Soup_final_fft'].apply(lambda x: np.abs(x))Campbell_Soup_fft_df['Campbell_Soup_fft_angle'] = Campbell_Soup_fft_df['Campbell_Soup_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Campbell_Soup_fft_list = np.asarray(Campbell_Soup_fft_df['Campbell_Soup_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Campbell_Soup_fft_list_m10= np.copy(Campbell_Soup_fft_list); Campbell_Soup_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Campbell_Soup_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Campbell_Soup_FT['Campbell_Soup_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Campbell_Soup (close) stock prices & Fourier transforms')plt.legend()plt.show()#Church_Dwight_FFTChurch_Dwight_FT = SP500_TechIndicator[['Date', 'Church_Dwight_Close']]Church_Dwight_Close_fft = np.fft.fft(np.asarray(Church_Dwight_FT['Church_Dwight_Close'].tolist()))Church_Dwight_fft_df = pd.DataFrame({'Church_Dwight_final_fft':Church_Dwight_Close_fft})Church_Dwight_fft_df['Church_Dwight_fft_absolute'] = Church_Dwight_fft_df['Church_Dwight_final_fft'].apply(lambda x: np.abs(x))Church_Dwight_fft_df['Church_Dwight_fft_angle'] = Church_Dwight_fft_df['Church_Dwight_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Church_Dwight_fft_list = np.asarray(Church_Dwight_fft_df['Church_Dwight_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Church_Dwight_fft_list_m10= np.copy(Church_Dwight_fft_list); Church_Dwight_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Church_Dwight_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Church_Dwight_FT['Church_Dwight_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Church_Dwight (close) stock prices & Fourier transforms')plt.legend()plt.show()#The_Clorox_Company_FFTThe_Clorox_Company_FT = SP500_TechIndicator[['Date', 'The_Clorox_Company_Close']]The_Clorox_Company_Close_fft = np.fft.fft(np.asarray(The_Clorox_Company_FT['The_Clorox_Company_Close'].tolist()))The_Clorox_Company_fft_df = pd.DataFrame({'The_Clorox_Company_final_fft':The_Clorox_Company_Close_fft})The_Clorox_Company_fft_df['The_Clorox_Company_fft_absolute'] = The_Clorox_Company_fft_df['The_Clorox_Company_final_fft'].apply(lambda x: np.abs(x))The_Clorox_Company_fft_df['The_Clorox_Company_fft_angle'] = The_Clorox_Company_fft_df['The_Clorox_Company_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)The_Clorox_Company_fft_list = np.asarray(The_Clorox_Company_fft_df['The_Clorox_Company_final_fft'].tolist())for num_ in [3, 6, 9, 100]: The_Clorox_Company_fft_list_m10= np.copy(The_Clorox_Company_fft_list); The_Clorox_Company_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(The_Clorox_Company_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(The_Clorox_Company_FT['The_Clorox_Company_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: The_Clorox_Company (close) stock prices & Fourier transforms')plt.legend()plt.show()#Coca_Cola_Company_FFTCoca_Cola_Company_FT = SP500_TechIndicator[['Date', 'Coca_Cola_Company_Close']]Coca_Cola_Company_Close_fft = np.fft.fft(np.asarray(Coca_Cola_Company_FT['Coca_Cola_Company_Close'].tolist()))Coca_Cola_Company_fft_df = pd.DataFrame({'Coca_Cola_Company_final_fft':Coca_Cola_Company_Close_fft})Coca_Cola_Company_fft_df['Coca_Cola_Company_fft_absolute'] = Coca_Cola_Company_fft_df['Coca_Cola_Company_final_fft'].apply(lambda x: np.abs(x))Coca_Cola_Company_fft_df['Coca_Cola_Company_fft_angle'] = Coca_Cola_Company_fft_df['Coca_Cola_Company_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Coca_Cola_Company_fft_list = np.asarray(Coca_Cola_Company_fft_df['Coca_Cola_Company_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Coca_Cola_Company_fft_list_m10= np.copy(Coca_Cola_Company_fft_list); Coca_Cola_Company_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Coca_Cola_Company_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Coca_Cola_Company_FT['Coca_Cola_Company_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Coca_Cola_Company (close) stock prices & Fourier transforms')plt.legend()plt.show()#Colgate_Palmolive_FFTColgate_Palmolive_FT = SP500_TechIndicator[['Date', 'Colgate_Palmolive_Close']]Colgate_Palmolive_Close_fft = np.fft.fft(np.asarray(Colgate_Palmolive_FT['Colgate_Palmolive_Close'].tolist()))Colgate_Palmolive_fft_df = pd.DataFrame({'Colgate_Palmolive_final_fft':Colgate_Palmolive_Close_fft})Colgate_Palmolive_fft_df['Colgate_Palmolive_fft_absolute'] = Colgate_Palmolive_fft_df['Colgate_Palmolive_final_fft'].apply(lambda x: np.abs(x))Colgate_Palmolive_fft_df['Colgate_Palmolive_fft_angle'] = Colgate_Palmolive_fft_df['Colgate_Palmolive_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Colgate_Palmolive_fft_list = np.asarray(Colgate_Palmolive_fft_df['Colgate_Palmolive_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Colgate_Palmolive_fft_list_m10= np.copy(Colgate_Palmolive_fft_list); Colgate_Palmolive_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Colgate_Palmolive_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Colgate_Palmolive_FT['Colgate_Palmolive_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Colgate_Palmolive (close) stock prices & Fourier transforms')plt.legend()plt.show()#Conagra_Brands_FFTConagra_Brands_FT = SP500_TechIndicator[['Date', 'Conagra_Brands_Close']]Conagra_Brands_Close_fft = np.fft.fft(np.asarray(Conagra_Brands_FT['Conagra_Brands_Close'].tolist()))Conagra_Brands_fft_df = pd.DataFrame({'Conagra_Brands_final_fft':Conagra_Brands_Close_fft})Conagra_Brands_fft_df['Conagra_Brands_fft_absolute'] = Conagra_Brands_fft_df['Conagra_Brands_final_fft'].apply(lambda x: np.abs(x))Conagra_Brands_fft_df['Conagra_Brands_fft_angle'] = Conagra_Brands_fft_df['Conagra_Brands_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Conagra_Brands_fft_list = np.asarray(Conagra_Brands_fft_df['Conagra_Brands_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Conagra_Brands_fft_list_m10= np.copy(Conagra_Brands_fft_list); Conagra_Brands_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Conagra_Brands_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Conagra_Brands_FT['Conagra_Brands_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Conagra_Brands (close) stock prices & Fourier transforms')plt.legend()plt.show()#Constellation_Brands_FFTConstellation_Brands_FT = SP500_TechIndicator[['Date', 'Constellation_Brands_Close']]Constellation_Brands_Close_fft = np.fft.fft(np.asarray(Constellation_Brands_FT['Constellation_Brands_Close'].tolist()))Constellation_Brands_fft_df = pd.DataFrame({'Constellation_Brands_final_fft':Constellation_Brands_Close_fft})Constellation_Brands_fft_df['Constellation_Brands_fft_absolute'] = Constellation_Brands_fft_df['Constellation_Brands_final_fft'].apply(lambda x: np.abs(x))Constellation_Brands_fft_df['Constellation_Brands_fft_angle'] = Constellation_Brands_fft_df['Constellation_Brands_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Constellation_Brands_fft_list = np.asarray(Constellation_Brands_fft_df['Constellation_Brands_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Constellation_Brands_fft_list_m10= np.copy(Constellation_Brands_fft_list); Constellation_Brands_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Constellation_Brands_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Constellation_Brands_FT['Constellation_Brands_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Constellation_Brands (close) stock prices & Fourier transforms')plt.legend()plt.show()#Costco_Wholesale_FFTCostco_Wholesale_FT = SP500_TechIndicator[['Date', 'Costco_Wholesale_Close']]Costco_Wholesale_Close_fft = np.fft.fft(np.asarray(Costco_Wholesale_FT['Costco_Wholesale_Close'].tolist()))Costco_Wholesale_fft_df = pd.DataFrame({'Costco_Wholesale_final_fft':Costco_Wholesale_Close_fft})Costco_Wholesale_fft_df['Costco_Wholesale_fft_absolute'] = Costco_Wholesale_fft_df['Costco_Wholesale_final_fft'].apply(lambda x: np.abs(x))Costco_Wholesale_fft_df['Costco_Wholesale_fft_angle'] = Costco_Wholesale_fft_df['Costco_Wholesale_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Costco_Wholesale_fft_list = np.asarray(Costco_Wholesale_fft_df['Costco_Wholesale_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Costco_Wholesale_fft_list_m10= np.copy(Costco_Wholesale_fft_list); Costco_Wholesale_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Costco_Wholesale_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Costco_Wholesale_FT['Costco_Wholesale_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Costco_Wholesale (close) stock prices & Fourier transforms')plt.legend()plt.show()#Coty_FFTCoty_FT = SP500_TechIndicator[['Date', 'Coty_Close']]Coty_Close_fft = np.fft.fft(np.asarray(Coty_FT['Coty_Close'].tolist()))Coty_fft_df = pd.DataFrame({'Coty_final_fft':Coty_Close_fft})Coty_fft_df['Coty_fft_absolute'] = Coty_fft_df['Coty_final_fft'].apply(lambda x: np.abs(x))Coty_fft_df['Coty_fft_angle'] = Coty_fft_df['Coty_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Coty_fft_list = np.asarray(Coty_fft_df['Coty_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Coty_fft_list_m10= np.copy(Coty_fft_list); Coty_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Coty_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Coty_FT['Coty_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Coty (close) stock prices & Fourier transforms')plt.legend()plt.show()#General_Mills_FFTGeneral_Mills_FT = SP500_TechIndicator[['Date', 'General_Mills_Close']]General_Mills_Close_fft = np.fft.fft(np.asarray(General_Mills_FT['General_Mills_Close'].tolist()))General_Mills_fft_df = pd.DataFrame({'General_Mills_final_fft':General_Mills_Close_fft})General_Mills_fft_df['General_Mills_fft_absolute'] = General_Mills_fft_df['General_Mills_final_fft'].apply(lambda x: np.abs(x))General_Mills_fft_df['General_Mills_fft_angle'] = General_Mills_fft_df['General_Mills_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)General_Mills_fft_list = np.asarray(General_Mills_fft_df['General_Mills_final_fft'].tolist())for num_ in [3, 6, 9, 100]: General_Mills_fft_list_m10= np.copy(General_Mills_fft_list); General_Mills_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(General_Mills_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(General_Mills_FT['General_Mills_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: General_Mills (close) stock prices & Fourier transforms')plt.legend()plt.show()#The_Hershey_Company_FFTThe_Hershey_Company_FT = SP500_TechIndicator[['Date', 'The_Hershey_Company_Close']]The_Hershey_Company_Close_fft = np.fft.fft(np.asarray(The_Hershey_Company_FT['The_Hershey_Company_Close'].tolist()))The_Hershey_Company_fft_df = pd.DataFrame({'The_Hershey_Company_final_fft':The_Hershey_Company_Close_fft})The_Hershey_Company_fft_df['The_Hershey_Company_fft_absolute'] = The_Hershey_Company_fft_df['The_Hershey_Company_final_fft'].apply(lambda x: np.abs(x))The_Hershey_Company_fft_df['The_Hershey_Company_fft_angle'] = The_Hershey_Company_fft_df['The_Hershey_Company_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)The_Hershey_Company_fft_list = np.asarray(The_Hershey_Company_fft_df['The_Hershey_Company_final_fft'].tolist())for num_ in [3, 6, 9, 100]: The_Hershey_Company_fft_list_m10= np.copy(The_Hershey_Company_fft_list); The_Hershey_Company_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(The_Hershey_Company_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(The_Hershey_Company_FT['The_Hershey_Company_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: The_Hershey_Company (close) stock prices & Fourier transforms')plt.legend()plt.show()#Hormel_Foods_FFTHormel_Foods_FT = SP500_TechIndicator[['Date', 'Hormel_Foods_Close']]Hormel_Foods_Close_fft = np.fft.fft(np.asarray(Hormel_Foods_FT['Hormel_Foods_Close'].tolist()))Hormel_Foods_fft_df = pd.DataFrame({'Hormel_Foods_final_fft':Hormel_Foods_Close_fft})Hormel_Foods_fft_df['Hormel_Foods_fft_absolute'] = Hormel_Foods_fft_df['Hormel_Foods_final_fft'].apply(lambda x: np.abs(x))Hormel_Foods_fft_df['Hormel_Foods_fft_angle'] = Hormel_Foods_fft_df['Hormel_Foods_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Hormel_Foods_fft_list = np.asarray(Hormel_Foods_fft_df['Hormel_Foods_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Hormel_Foods_fft_list_m10= np.copy(Hormel_Foods_fft_list); Hormel_Foods_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Hormel_Foods_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Hormel_Foods_FT['Hormel_Foods_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Hormel_Foods (close) stock prices & Fourier transforms')plt.legend()plt.show()#JM_Smucker_FFTJM_Smucker_FT = SP500_TechIndicator[['Date', 'JM_Smucker_Close']]JM_Smucker_Close_fft = np.fft.fft(np.asarray(JM_Smucker_FT['JM_Smucker_Close'].tolist()))JM_Smucker_fft_df = pd.DataFrame({'JM_Smucker_final_fft':JM_Smucker_Close_fft})JM_Smucker_fft_df['JM_Smucker_fft_absolute'] = JM_Smucker_fft_df['JM_Smucker_final_fft'].apply(lambda x: np.abs(x))JM_Smucker_fft_df['JM_Smucker_fft_angle'] = JM_Smucker_fft_df['JM_Smucker_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)JM_Smucker_fft_list = np.asarray(JM_Smucker_fft_df['JM_Smucker_final_fft'].tolist())for num_ in [3, 6, 9, 100]: JM_Smucker_fft_list_m10= np.copy(JM_Smucker_fft_list); JM_Smucker_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(JM_Smucker_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(JM_Smucker_FT['JM_Smucker_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: JM_Smucker (close) stock prices & Fourier transforms')plt.legend()plt.show()#Kellogg_FFTKellogg_FT = SP500_TechIndicator[['Date', 'Kellogg_Close']]Kellogg_Close_fft = np.fft.fft(np.asarray(Kellogg_FT['Kellogg_Close'].tolist()))Kellogg_fft_df = pd.DataFrame({'Kellogg_final_fft':Kellogg_Close_fft})Kellogg_fft_df['Kellogg_fft_absolute'] = Kellogg_fft_df['Kellogg_final_fft'].apply(lambda x: np.abs(x))Kellogg_fft_df['Kellogg_fft_angle'] = Kellogg_fft_df['Kellogg_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Kellogg_fft_list = np.asarray(Kellogg_fft_df['Kellogg_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Kellogg_fft_list_m10= np.copy(Kellogg_fft_list); Kellogg_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Kellogg_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Kellogg_FT['Kellogg_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Kellogg (close) stock prices & Fourier transforms')plt.legend()plt.show()#Kimberly_Clark_FFTKimberly_Clark_FT = SP500_TechIndicator[['Date', 'Kimberly_Clark_Close']]Kimberly_Clark_Close_fft = np.fft.fft(np.asarray(Kimberly_Clark_FT['Kimberly_Clark_Close'].tolist()))Kimberly_Clark_fft_df = pd.DataFrame({'Kimberly_Clark_final_fft':Kimberly_Clark_Close_fft})Kimberly_Clark_fft_df['Kimberly_Clark_fft_absolute'] = Kimberly_Clark_fft_df['Kimberly_Clark_final_fft'].apply(lambda x: np.abs(x))Kimberly_Clark_fft_df['Kimberly_Clark_fft_angle'] = Kimberly_Clark_fft_df['Kimberly_Clark_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Kimberly_Clark_fft_list = np.asarray(Kimberly_Clark_fft_df['Kimberly_Clark_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Kimberly_Clark_fft_list_m10= np.copy(Kimberly_Clark_fft_list); Kimberly_Clark_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Kimberly_Clark_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Kimberly_Clark_FT['Kimberly_Clark_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Kimberly_Clark (close) stock prices & Fourier transforms')plt.legend()plt.show()#Kroger_FFTKroger_FT = SP500_TechIndicator[['Date', 'Kroger_Close']]Kroger_Close_fft = np.fft.fft(np.asarray(Kroger_FT['Kroger_Close'].tolist()))Kroger_fft_df = pd.DataFrame({'Kroger_final_fft':Kroger_Close_fft})Kroger_fft_df['Kroger_fft_absolute'] = Kroger_fft_df['Kroger_final_fft'].apply(lambda x: np.abs(x))Kroger_fft_df['Kroger_fft_angle'] = Kroger_fft_df['Kroger_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Kroger_fft_list = np.asarray(Kroger_fft_df['Kroger_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Kroger_fft_list_m10= np.copy(Kroger_fft_list); Kroger_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Kroger_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Kroger_FT['Kroger_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Kroger (close) stock prices & Fourier transforms')plt.legend()plt.show()#McCormick_FFTMcCormick_FT = SP500_TechIndicator[['Date', 'McCormick_Close']]McCormick_Close_fft = np.fft.fft(np.asarray(McCormick_FT['McCormick_Close'].tolist()))McCormick_fft_df = pd.DataFrame({'McCormick_final_fft':McCormick_Close_fft})McCormick_fft_df['McCormick_fft_absolute'] = McCormick_fft_df['McCormick_final_fft'].apply(lambda x: np.abs(x))McCormick_fft_df['McCormick_fft_angle'] = McCormick_fft_df['McCormick_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)McCormick_fft_list = np.asarray(McCormick_fft_df['McCormick_final_fft'].tolist())for num_ in [3, 6, 9, 100]: McCormick_fft_list_m10= np.copy(McCormick_fft_list); McCormick_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(McCormick_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(McCormick_FT['McCormick_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: McCormick (close) stock prices & Fourier transforms')plt.legend()plt.show()#Molson_Coors_Brewing_Company_FFTMolson_Coors_Brewing_Company_FT = SP500_TechIndicator[['Date', 'Molson_Coors_Brewing_Company_Close']]Molson_Coors_Brewing_Company_Close_fft = np.fft.fft(np.asarray(Molson_Coors_Brewing_Company_FT['Molson_Coors_Brewing_Company_Close'].tolist()))Molson_Coors_Brewing_Company_fft_df = pd.DataFrame({'Molson_Coors_Brewing_Company_final_fft':Molson_Coors_Brewing_Company_Close_fft})Molson_Coors_Brewing_Company_fft_df['Molson_Coors_Brewing_Company_fft_absolute'] = Molson_Coors_Brewing_Company_fft_df['Molson_Coors_Brewing_Company_final_fft'].apply(lambda x: np.abs(x))Molson_Coors_Brewing_Company_fft_df['Molson_Coors_Brewing_Company_fft_angle'] = Molson_Coors_Brewing_Company_fft_df['Molson_Coors_Brewing_Company_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Molson_Coors_Brewing_Company_fft_list = np.asarray(Molson_Coors_Brewing_Company_fft_df['Molson_Coors_Brewing_Company_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Molson_Coors_Brewing_Company_fft_list_m10= np.copy(Molson_Coors_Brewing_Company_fft_list); Molson_Coors_Brewing_Company_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Molson_Coors_Brewing_Company_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Molson_Coors_Brewing_Company_FT['Molson_Coors_Brewing_Company_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Molson_Coors_Brewing_Company (close) stock prices & Fourier transforms')plt.legend()plt.show()#Mondelez_International_FFTMondelez_International_FT = SP500_TechIndicator[['Date', 'Mondelez_International_Close']]Mondelez_International_Close_fft = np.fft.fft(np.asarray(Mondelez_International_FT['Mondelez_International_Close'].tolist()))Mondelez_International_fft_df = pd.DataFrame({'Mondelez_International_final_fft':Mondelez_International_Close_fft})Mondelez_International_fft_df['Mondelez_International_fft_absolute'] = Mondelez_International_fft_df['Mondelez_International_final_fft'].apply(lambda x: np.abs(x))Mondelez_International_fft_df['Mondelez_International_fft_angle'] = Mondelez_International_fft_df['Mondelez_International_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Mondelez_International_fft_list = np.asarray(Mondelez_International_fft_df['Mondelez_International_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Mondelez_International_fft_list_m10= np.copy(Mondelez_International_fft_list); Mondelez_International_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Mondelez_International_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Mondelez_International_FT['Mondelez_International_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Mondelez_International (close) stock prices & Fourier transforms')plt.legend()plt.show()#Monster_Beverage_FFTMonster_Beverage_FT = SP500_TechIndicator[['Date', 'Monster_Beverage_Close']]Monster_Beverage_Close_fft = np.fft.fft(np.asarray(Monster_Beverage_FT['Monster_Beverage_Close'].tolist()))Monster_Beverage_fft_df = pd.DataFrame({'Monster_Beverage_final_fft':Monster_Beverage_Close_fft})Monster_Beverage_fft_df['Monster_Beverage_fft_absolute'] = Monster_Beverage_fft_df['Monster_Beverage_final_fft'].apply(lambda x: np.abs(x))Monster_Beverage_fft_df['Monster_Beverage_fft_angle'] = Monster_Beverage_fft_df['Monster_Beverage_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Monster_Beverage_fft_list = np.asarray(Monster_Beverage_fft_df['Monster_Beverage_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Monster_Beverage_fft_list_m10= np.copy(Monster_Beverage_fft_list); Monster_Beverage_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Monster_Beverage_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Monster_Beverage_FT['Monster_Beverage_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Monster_Beverage (close) stock prices & Fourier transforms')plt.legend()plt.show()#PepsiCo_FFTPepsiCo_FT = SP500_TechIndicator[['Date', 'PepsiCo_Close']]PepsiCo_Close_fft = np.fft.fft(np.asarray(PepsiCo_FT['PepsiCo_Close'].tolist()))PepsiCo_fft_df = pd.DataFrame({'PepsiCo_final_fft':PepsiCo_Close_fft})PepsiCo_fft_df['PepsiCo_fft_absolute'] = PepsiCo_fft_df['PepsiCo_final_fft'].apply(lambda x: np.abs(x))PepsiCo_fft_df['PepsiCo_fft_angle'] = PepsiCo_fft_df['PepsiCo_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)PepsiCo_fft_list = np.asarray(PepsiCo_fft_df['PepsiCo_final_fft'].tolist())for num_ in [3, 6, 9, 100]: PepsiCo_fft_list_m10= np.copy(PepsiCo_fft_list); PepsiCo_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(PepsiCo_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(PepsiCo_FT['PepsiCo_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: PepsiCo (close) stock prices & Fourier transforms')plt.legend()plt.show()#Philip_Morris_International_FFTPhilip_Morris_International_FT = SP500_TechIndicator[['Date', 'Philip_Morris_International_Close']]Philip_Morris_International_Close_fft = np.fft.fft(np.asarray(Philip_Morris_International_FT['Philip_Morris_International_Close'].tolist()))Philip_Morris_International_fft_df = pd.DataFrame({'Philip_Morris_International_final_fft':Philip_Morris_International_Close_fft})Philip_Morris_International_fft_df['Philip_Morris_International_fft_absolute'] = Philip_Morris_International_fft_df['Philip_Morris_International_final_fft'].apply(lambda x: np.abs(x))Philip_Morris_International_fft_df['Philip_Morris_International_fft_angle'] = Philip_Morris_International_fft_df['Philip_Morris_International_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Philip_Morris_International_fft_list = np.asarray(Philip_Morris_International_fft_df['Philip_Morris_International_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Philip_Morris_International_fft_list_m10= np.copy(Philip_Morris_International_fft_list); Philip_Morris_International_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Philip_Morris_International_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Philip_Morris_International_FT['Philip_Morris_International_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Philip_Morris_International (close) stock prices & Fourier transforms')plt.legend()plt.show()#Procter_Gamble_FFTProcter_Gamble_FT = SP500_TechIndicator[['Date', 'Procter_Gamble_Close']]Procter_Gamble_Close_fft = np.fft.fft(np.asarray(Procter_Gamble_FT['Procter_Gamble_Close'].tolist()))Procter_Gamble_fft_df = pd.DataFrame({'Procter_Gamble_final_fft':Procter_Gamble_Close_fft})Procter_Gamble_fft_df['Procter_Gamble_fft_absolute'] = Procter_Gamble_fft_df['Procter_Gamble_final_fft'].apply(lambda x: np.abs(x))Procter_Gamble_fft_df['Procter_Gamble_fft_angle'] = Procter_Gamble_fft_df['Procter_Gamble_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Procter_Gamble_fft_list = np.asarray(Procter_Gamble_fft_df['Procter_Gamble_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Procter_Gamble_fft_list_m10= np.copy(Procter_Gamble_fft_list); Procter_Gamble_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Procter_Gamble_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Procter_Gamble_FT['Procter_Gamble_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Procter_Gamble (close) stock prices & Fourier transforms')plt.legend()plt.show()#Sysco_FFTSysco_FT = SP500_TechIndicator[['Date', 'Sysco_Close']]Sysco_Close_fft = np.fft.fft(np.asarray(Sysco_FT['Sysco_Close'].tolist()))Sysco_fft_df = pd.DataFrame({'Sysco_final_fft':Sysco_Close_fft})Sysco_fft_df['Sysco_fft_absolute'] = Sysco_fft_df['Sysco_final_fft'].apply(lambda x: np.abs(x))Sysco_fft_df['Sysco_fft_angle'] = Sysco_fft_df['Sysco_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Sysco_fft_list = np.asarray(Sysco_fft_df['Sysco_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Sysco_fft_list_m10= np.copy(Sysco_fft_list); Sysco_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Sysco_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Sysco_FT['Sysco_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Sysco (close) stock prices & Fourier transforms')plt.legend()plt.show()#Tyson_Foods_FFTTyson_Foods_FT = SP500_TechIndicator[['Date', 'Tyson_Foods_Close']]Tyson_Foods_Close_fft = np.fft.fft(np.asarray(Tyson_Foods_FT['Tyson_Foods_Close'].tolist()))Tyson_Foods_fft_df = pd.DataFrame({'Tyson_Foods_final_fft':Tyson_Foods_Close_fft})Tyson_Foods_fft_df['Tyson_Foods_fft_absolute'] = Tyson_Foods_fft_df['Tyson_Foods_final_fft'].apply(lambda x: np.abs(x))Tyson_Foods_fft_df['Tyson_Foods_fft_angle'] = Tyson_Foods_fft_df['Tyson_Foods_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Tyson_Foods_fft_list = np.asarray(Tyson_Foods_fft_df['Tyson_Foods_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Tyson_Foods_fft_list_m10= np.copy(Tyson_Foods_fft_list); Tyson_Foods_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Tyson_Foods_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Tyson_Foods_FT['Tyson_Foods_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Tyson_Foods (close) stock prices & Fourier transforms')plt.legend()plt.show()#Walmart_FFTWalmart_FT = SP500_TechIndicator[['Date', 'Walmart_Close']]Walmart_Close_fft = np.fft.fft(np.asarray(Walmart_FT['Walmart_Close'].tolist()))Walmart_fft_df = pd.DataFrame({'Walmart_final_fft':Walmart_Close_fft})Walmart_fft_df['Walmart_fft_absolute'] = Walmart_fft_df['Walmart_final_fft'].apply(lambda x: np.abs(x))Walmart_fft_df['Walmart_fft_angle'] = Walmart_fft_df['Walmart_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Walmart_fft_list = np.asarray(Walmart_fft_df['Walmart_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Walmart_fft_list_m10= np.copy(Walmart_fft_list); Walmart_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Walmart_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Walmart_FT['Walmart_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Walmart (close) stock prices & Fourier transforms')plt.legend()plt.show()#Walgreens_Boots_Alliance_FFTWalgreens_Boots_Alliance_FT = SP500_TechIndicator[['Date', 'Walgreens_Boots_Alliance_Close']]Walgreens_Boots_Alliance_Close_fft = np.fft.fft(np.asarray(Walgreens_Boots_Alliance_FT['Walgreens_Boots_Alliance_Close'].tolist()))Walgreens_Boots_Alliance_fft_df = pd.DataFrame({'Walgreens_Boots_Alliance_final_fft':Walgreens_Boots_Alliance_Close_fft})Walgreens_Boots_Alliance_fft_df['Walgreens_Boots_Alliance_fft_absolute'] = Walgreens_Boots_Alliance_fft_df['Walgreens_Boots_Alliance_final_fft'].apply(lambda x: np.abs(x))Walgreens_Boots_Alliance_fft_df['Walgreens_Boots_Alliance_fft_angle'] = Walgreens_Boots_Alliance_fft_df['Walgreens_Boots_Alliance_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Walgreens_Boots_Alliance_fft_list = np.asarray(Walgreens_Boots_Alliance_fft_df['Walgreens_Boots_Alliance_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Walgreens_Boots_Alliance_fft_list_m10= np.copy(Walgreens_Boots_Alliance_fft_list); Walgreens_Boots_Alliance_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Walgreens_Boots_Alliance_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Walgreens_Boots_Alliance_FT['Walgreens_Boots_Alliance_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Walgreens_Boots_Alliance (close) stock prices & Fourier transforms')plt.legend()plt.show()#Anadarko_Petroleum_FFTAnadarko_Petroleum_FT = SP500_TechIndicator[['Date', 'Anadarko_Petroleum_Close']]Anadarko_Petroleum_Close_fft = np.fft.fft(np.asarray(Anadarko_Petroleum_FT['Anadarko_Petroleum_Close'].tolist()))Anadarko_Petroleum_fft_df = pd.DataFrame({'Anadarko_Petroleum_final_fft':Anadarko_Petroleum_Close_fft})Anadarko_Petroleum_fft_df['Anadarko_Petroleum_fft_absolute'] = Anadarko_Petroleum_fft_df['Anadarko_Petroleum_final_fft'].apply(lambda x: np.abs(x))Anadarko_Petroleum_fft_df['Anadarko_Petroleum_fft_angle'] = Anadarko_Petroleum_fft_df['Anadarko_Petroleum_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Anadarko_Petroleum_fft_list = np.asarray(Anadarko_Petroleum_fft_df['Anadarko_Petroleum_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Anadarko_Petroleum_fft_list_m10= np.copy(Anadarko_Petroleum_fft_list); Anadarko_Petroleum_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Anadarko_Petroleum_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Anadarko_Petroleum_FT['Anadarko_Petroleum_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Anadarko_Petroleum (close) stock prices & Fourier transforms')plt.legend()plt.show()#Apache_Corporation_FFTApache_Corporation_FT = SP500_TechIndicator[['Date', 'Apache_Corporation_Close']]Apache_Corporation_Close_fft = np.fft.fft(np.asarray(Apache_Corporation_FT['Apache_Corporation_Close'].tolist()))Apache_Corporation_fft_df = pd.DataFrame({'Apache_Corporation_final_fft':Apache_Corporation_Close_fft})Apache_Corporation_fft_df['Apache_Corporation_fft_absolute'] = Apache_Corporation_fft_df['Apache_Corporation_final_fft'].apply(lambda x: np.abs(x))Apache_Corporation_fft_df['Apache_Corporation_fft_angle'] = Apache_Corporation_fft_df['Apache_Corporation_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Apache_Corporation_fft_list = np.asarray(Apache_Corporation_fft_df['Apache_Corporation_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Apache_Corporation_fft_list_m10= np.copy(Apache_Corporation_fft_list); Apache_Corporation_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Apache_Corporation_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Apache_Corporation_FT['Apache_Corporation_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Apache_Corporation (close) stock prices & Fourier transforms')plt.legend()plt.show()x
#Cabot_Oil_Gas_FFTCabot_Oil_Gas_FT = SP500_TechIndicator[['Date', 'Cabot_Oil_Gas_Close']]Cabot_Oil_Gas_Close_fft = np.fft.fft(np.asarray(Cabot_Oil_Gas_FT['Cabot_Oil_Gas_Close'].tolist()))Cabot_Oil_Gas_fft_df = pd.DataFrame({'Cabot_Oil_Gas_final_fft':Cabot_Oil_Gas_Close_fft})Cabot_Oil_Gas_fft_df['Cabot_Oil_Gas_fft_absolute'] = Cabot_Oil_Gas_fft_df['Cabot_Oil_Gas_final_fft'].apply(lambda x: np.abs(x))Cabot_Oil_Gas_fft_df['Cabot_Oil_Gas_fft_angle'] = Cabot_Oil_Gas_fft_df['Cabot_Oil_Gas_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Cabot_Oil_Gas_fft_list = np.asarray(Cabot_Oil_Gas_fft_df['Cabot_Oil_Gas_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Cabot_Oil_Gas_fft_list_m10= np.copy(Cabot_Oil_Gas_fft_list); Cabot_Oil_Gas_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Cabot_Oil_Gas_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Cabot_Oil_Gas_FT['Cabot_Oil_Gas_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Cabot_Oil_Gas (close) stock prices & Fourier transforms')plt.legend()plt.show()#Chevron_FFTChevron_FT = SP500_TechIndicator[['Date', 'Chevron_Close']]Chevron_Close_fft = np.fft.fft(np.asarray(Chevron_FT['Chevron_Close'].tolist()))Chevron_fft_df = pd.DataFrame({'Chevron_final_fft':Chevron_Close_fft})Chevron_fft_df['Chevron_fft_absolute'] = Chevron_fft_df['Chevron_final_fft'].apply(lambda x: np.abs(x))Chevron_fft_df['Chevron_fft_angle'] = Chevron_fft_df['Chevron_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Chevron_fft_list = np.asarray(Chevron_fft_df['Chevron_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Chevron_fft_list_m10= np.copy(Chevron_fft_list); Chevron_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Chevron_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Chevron_FT['Chevron_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Chevron (close) stock prices & Fourier transforms')plt.legend()plt.show()#Cimarex_Energy_FFTCimarex_Energy_FT = SP500_TechIndicator[['Date', 'Cimarex_Energy_Close']]Cimarex_Energy_Close_fft = np.fft.fft(np.asarray(Cimarex_Energy_FT['Cimarex_Energy_Close'].tolist()))Cimarex_Energy_fft_df = pd.DataFrame({'Cimarex_Energy_final_fft':Cimarex_Energy_Close_fft})Cimarex_Energy_fft_df['Cimarex_Energy_fft_absolute'] = Cimarex_Energy_fft_df['Cimarex_Energy_final_fft'].apply(lambda x: np.abs(x))Cimarex_Energy_fft_df['Cimarex_Energy_fft_angle'] = Cimarex_Energy_fft_df['Cimarex_Energy_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Cimarex_Energy_fft_list = np.asarray(Cimarex_Energy_fft_df['Cimarex_Energy_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Cimarex_Energy_fft_list_m10= np.copy(Cimarex_Energy_fft_list); Cimarex_Energy_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Cimarex_Energy_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Cimarex_Energy_FT['Cimarex_Energy_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Cimarex_Energy (close) stock prices & Fourier transforms')plt.legend()plt.show()#Concho_Resources_FFTConcho_Resources_FT = SP500_TechIndicator[['Date', 'Concho_Resources_Close']]Concho_Resources_Close_fft = np.fft.fft(np.asarray(Concho_Resources_FT['Concho_Resources_Close'].tolist()))Concho_Resources_fft_df = pd.DataFrame({'Concho_Resources_final_fft':Concho_Resources_Close_fft})Concho_Resources_fft_df['Concho_Resources_fft_absolute'] = Concho_Resources_fft_df['Concho_Resources_final_fft'].apply(lambda x: np.abs(x))Concho_Resources_fft_df['Concho_Resources_fft_angle'] = Concho_Resources_fft_df['Concho_Resources_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Concho_Resources_fft_list = np.asarray(Concho_Resources_fft_df['Concho_Resources_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Concho_Resources_fft_list_m10= np.copy(Concho_Resources_fft_list); Concho_Resources_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Concho_Resources_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Concho_Resources_FT['Concho_Resources_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Concho_Resources (close) stock prices & Fourier transforms')plt.legend()plt.show()#ConocoPhillips_FFTConocoPhillips_FT = SP500_TechIndicator[['Date', 'ConocoPhillips_Close']]ConocoPhillips_Close_fft = np.fft.fft(np.asarray(ConocoPhillips_FT['ConocoPhillips_Close'].tolist()))ConocoPhillips_fft_df = pd.DataFrame({'ConocoPhillips_final_fft':ConocoPhillips_Close_fft})ConocoPhillips_fft_df['ConocoPhillips_fft_absolute'] = ConocoPhillips_fft_df['ConocoPhillips_final_fft'].apply(lambda x: np.abs(x))ConocoPhillips_fft_df['ConocoPhillips_fft_angle'] = ConocoPhillips_fft_df['ConocoPhillips_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)ConocoPhillips_fft_list = np.asarray(ConocoPhillips_fft_df['ConocoPhillips_final_fft'].tolist())for num_ in [3, 6, 9, 100]: ConocoPhillips_fft_list_m10= np.copy(ConocoPhillips_fft_list); ConocoPhillips_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(ConocoPhillips_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(ConocoPhillips_FT['ConocoPhillips_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: ConocoPhillips (close) stock prices & Fourier transforms')plt.legend()plt.show()#Devon_Energy_FFTDevon_Energy_FT = SP500_TechIndicator[['Date', 'Devon_Energy_Close']]Devon_Energy_Close_fft = np.fft.fft(np.asarray(Devon_Energy_FT['Devon_Energy_Close'].tolist()))Devon_Energy_fft_df = pd.DataFrame({'Devon_Energy_final_fft':Devon_Energy_Close_fft})Devon_Energy_fft_df['Devon_Energy_fft_absolute'] = Devon_Energy_fft_df['Devon_Energy_final_fft'].apply(lambda x: np.abs(x))Devon_Energy_fft_df['Devon_Energy_fft_angle'] = Devon_Energy_fft_df['Devon_Energy_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Devon_Energy_fft_list = np.asarray(Devon_Energy_fft_df['Devon_Energy_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Devon_Energy_fft_list_m10= np.copy(Devon_Energy_fft_list); Devon_Energy_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Devon_Energy_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Devon_Energy_FT['Devon_Energy_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Devon_Energy (close) stock prices & Fourier transforms')plt.legend()plt.show()#Diamondback_Energy_FFTDiamondback_Energy_FT = SP500_TechIndicator[['Date', 'Diamondback_Energy_Close']]Diamondback_Energy_Close_fft = np.fft.fft(np.asarray(Diamondback_Energy_FT['Diamondback_Energy_Close'].tolist()))Diamondback_Energy_fft_df = pd.DataFrame({'Diamondback_Energy_final_fft':Diamondback_Energy_Close_fft})Diamondback_Energy_fft_df['Diamondback_Energy_fft_absolute'] = Diamondback_Energy_fft_df['Diamondback_Energy_final_fft'].apply(lambda x: np.abs(x))Diamondback_Energy_fft_df['Diamondback_Energy_fft_angle'] = Diamondback_Energy_fft_df['Diamondback_Energy_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Diamondback_Energy_fft_list = np.asarray(Diamondback_Energy_fft_df['Diamondback_Energy_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Diamondback_Energy_fft_list_m10= np.copy(Diamondback_Energy_fft_list); Diamondback_Energy_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Diamondback_Energy_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Diamondback_Energy_FT['Diamondback_Energy_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Diamondback_Energy (close) stock prices & Fourier transforms')plt.legend()plt.show()#EOG_Resources_FFTEOG_Resources_FT = SP500_TechIndicator[['Date', 'EOG_Resources_Close']]EOG_Resources_Close_fft = np.fft.fft(np.asarray(EOG_Resources_FT['EOG_Resources_Close'].tolist()))EOG_Resources_fft_df = pd.DataFrame({'EOG_Resources_final_fft':EOG_Resources_Close_fft})EOG_Resources_fft_df['EOG_Resources_fft_absolute'] = EOG_Resources_fft_df['EOG_Resources_final_fft'].apply(lambda x: np.abs(x))EOG_Resources_fft_df['EOG_Resources_fft_angle'] = EOG_Resources_fft_df['EOG_Resources_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)EOG_Resources_fft_list = np.asarray(EOG_Resources_fft_df['EOG_Resources_final_fft'].tolist())for num_ in [3, 6, 9, 100]: EOG_Resources_fft_list_m10= np.copy(EOG_Resources_fft_list); EOG_Resources_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(EOG_Resources_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(EOG_Resources_FT['EOG_Resources_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: EOG_Resources (close) stock prices & Fourier transforms')plt.legend()plt.show()#Exxon_Mobil_FFTExxon_Mobil_FT = SP500_TechIndicator[['Date', 'Exxon_Mobil_Close']]Exxon_Mobil_Close_fft = np.fft.fft(np.asarray(Exxon_Mobil_FT['Exxon_Mobil_Close'].tolist()))Exxon_Mobil_fft_df = pd.DataFrame({'Exxon_Mobil_final_fft':Exxon_Mobil_Close_fft})Exxon_Mobil_fft_df['Exxon_Mobil_fft_absolute'] = Exxon_Mobil_fft_df['Exxon_Mobil_final_fft'].apply(lambda x: np.abs(x))Exxon_Mobil_fft_df['Exxon_Mobil_fft_angle'] = Exxon_Mobil_fft_df['Exxon_Mobil_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Exxon_Mobil_fft_list = np.asarray(Exxon_Mobil_fft_df['Exxon_Mobil_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Exxon_Mobil_fft_list_m10= np.copy(Exxon_Mobil_fft_list); Exxon_Mobil_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Exxon_Mobil_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Exxon_Mobil_FT['Exxon_Mobil_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Exxon_Mobil (close) stock prices & Fourier transforms')plt.legend()plt.show()#Halliburton_FFTHalliburton_FT = SP500_TechIndicator[['Date', 'Halliburton_Close']]Halliburton_Close_fft = np.fft.fft(np.asarray(Halliburton_FT['Halliburton_Close'].tolist()))Halliburton_fft_df = pd.DataFrame({'Halliburton_final_fft':Halliburton_Close_fft})Halliburton_fft_df['Halliburton_fft_absolute'] = Halliburton_fft_df['Halliburton_final_fft'].apply(lambda x: np.abs(x))Halliburton_fft_df['Halliburton_fft_angle'] = Halliburton_fft_df['Halliburton_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Halliburton_fft_list = np.asarray(Halliburton_fft_df['Halliburton_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Halliburton_fft_list_m10= np.copy(Halliburton_fft_list); Halliburton_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Halliburton_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Halliburton_FT['Halliburton_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Halliburton (close) stock prices & Fourier transforms')plt.legend()plt.show()#Helmerich_Payne_FFTHelmerich_Payne_FT = SP500_TechIndicator[['Date', 'Helmerich_Payne_Close']]Helmerich_Payne_Close_fft = np.fft.fft(np.asarray(Helmerich_Payne_FT['Helmerich_Payne_Close'].tolist()))Helmerich_Payne_fft_df = pd.DataFrame({'Helmerich_Payne_final_fft':Helmerich_Payne_Close_fft})Helmerich_Payne_fft_df['Helmerich_Payne_fft_absolute'] = Helmerich_Payne_fft_df['Helmerich_Payne_final_fft'].apply(lambda x: np.abs(x))Helmerich_Payne_fft_df['Helmerich_Payne_fft_angle'] = Helmerich_Payne_fft_df['Helmerich_Payne_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Helmerich_Payne_fft_list = np.asarray(Helmerich_Payne_fft_df['Helmerich_Payne_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Helmerich_Payne_fft_list_m10= np.copy(Helmerich_Payne_fft_list); Helmerich_Payne_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Helmerich_Payne_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Helmerich_Payne_FT['Helmerich_Payne_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Helmerich_Payne (close) stock prices & Fourier transforms')plt.legend()plt.show()#Hess_Corporation_FFTHess_Corporation_FT = SP500_TechIndicator[['Date', 'Hess_Corporation_Close']]Hess_Corporation_Close_fft = np.fft.fft(np.asarray(Hess_Corporation_FT['Hess_Corporation_Close'].tolist()))Hess_Corporation_fft_df = pd.DataFrame({'Hess_Corporation_final_fft':Hess_Corporation_Close_fft})Hess_Corporation_fft_df['Hess_Corporation_fft_absolute'] = Hess_Corporation_fft_df['Hess_Corporation_final_fft'].apply(lambda x: np.abs(x))Hess_Corporation_fft_df['Hess_Corporation_fft_angle'] = Hess_Corporation_fft_df['Hess_Corporation_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Hess_Corporation_fft_list = np.asarray(Hess_Corporation_fft_df['Hess_Corporation_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Hess_Corporation_fft_list_m10= np.copy(Hess_Corporation_fft_list); Hess_Corporation_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Hess_Corporation_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Hess_Corporation_FT['Hess_Corporation_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Hess_Corporation (close) stock prices & Fourier transforms')plt.legend()plt.show()#Kinder_Morgan_FFTKinder_Morgan_FT = SP500_TechIndicator[['Date', 'Kinder_Morgan_Close']]Kinder_Morgan_Close_fft = np.fft.fft(np.asarray(Kinder_Morgan_FT['Kinder_Morgan_Close'].tolist()))Kinder_Morgan_fft_df = pd.DataFrame({'Kinder_Morgan_final_fft':Kinder_Morgan_Close_fft})Kinder_Morgan_fft_df['Kinder_Morgan_fft_absolute'] = Kinder_Morgan_fft_df['Kinder_Morgan_final_fft'].apply(lambda x: np.abs(x))Kinder_Morgan_fft_df['Kinder_Morgan_fft_angle'] = Kinder_Morgan_fft_df['Kinder_Morgan_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Kinder_Morgan_fft_list = np.asarray(Kinder_Morgan_fft_df['Kinder_Morgan_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Kinder_Morgan_fft_list_m10= np.copy(Kinder_Morgan_fft_list); Kinder_Morgan_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Kinder_Morgan_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Kinder_Morgan_FT['Kinder_Morgan_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Kinder_Morgan (close) stock prices & Fourier transforms')plt.legend()plt.show()#Marathon_Oil_FFTMarathon_Oil_FT = SP500_TechIndicator[['Date', 'Marathon_Oil_Close']]Marathon_Oil_Close_fft = np.fft.fft(np.asarray(Marathon_Oil_FT['Marathon_Oil_Close'].tolist()))Marathon_Oil_fft_df = pd.DataFrame({'Marathon_Oil_final_fft':Marathon_Oil_Close_fft})Marathon_Oil_fft_df['Marathon_Oil_fft_absolute'] = Marathon_Oil_fft_df['Marathon_Oil_final_fft'].apply(lambda x: np.abs(x))Marathon_Oil_fft_df['Marathon_Oil_fft_angle'] = Marathon_Oil_fft_df['Marathon_Oil_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Marathon_Oil_fft_list = np.asarray(Marathon_Oil_fft_df['Marathon_Oil_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Marathon_Oil_fft_list_m10= np.copy(Marathon_Oil_fft_list); Marathon_Oil_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Marathon_Oil_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Marathon_Oil_FT['Marathon_Oil_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Marathon_Oil (close) stock prices & Fourier transforms')plt.legend()plt.show()#Marathon_Petroleum_FFTMarathon_Petroleum_FT = SP500_TechIndicator[['Date', 'Marathon_Petroleum_Close']]Marathon_Petroleum_Close_fft = np.fft.fft(np.asarray(Marathon_Petroleum_FT['Marathon_Petroleum_Close'].tolist()))Marathon_Petroleum_fft_df = pd.DataFrame({'Marathon_Petroleum_final_fft':Marathon_Petroleum_Close_fft})Marathon_Petroleum_fft_df['Marathon_Petroleum_fft_absolute'] = Marathon_Petroleum_fft_df['Marathon_Petroleum_final_fft'].apply(lambda x: np.abs(x))Marathon_Petroleum_fft_df['Marathon_Petroleum_fft_angle'] = Marathon_Petroleum_fft_df['Marathon_Petroleum_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Marathon_Petroleum_fft_list = np.asarray(Marathon_Petroleum_fft_df['Marathon_Petroleum_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Marathon_Petroleum_fft_list_m10= np.copy(Marathon_Petroleum_fft_list); Marathon_Petroleum_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Marathon_Petroleum_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Marathon_Petroleum_FT['Marathon_Petroleum_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Marathon_Petroleum (close) stock prices & Fourier transforms')plt.legend()plt.show()#National_Oilwell_Varco_FFTNational_Oilwell_Varco_FT = SP500_TechIndicator[['Date', 'National_Oilwell_Varco_Close']]National_Oilwell_Varco_Close_fft = np.fft.fft(np.asarray(National_Oilwell_Varco_FT['National_Oilwell_Varco_Close'].tolist()))National_Oilwell_Varco_fft_df = pd.DataFrame({'National_Oilwell_Varco_final_fft':National_Oilwell_Varco_Close_fft})National_Oilwell_Varco_fft_df['National_Oilwell_Varco_fft_absolute'] = National_Oilwell_Varco_fft_df['National_Oilwell_Varco_final_fft'].apply(lambda x: np.abs(x))National_Oilwell_Varco_fft_df['National_Oilwell_Varco_fft_angle'] = National_Oilwell_Varco_fft_df['National_Oilwell_Varco_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)National_Oilwell_Varco_fft_list = np.asarray(National_Oilwell_Varco_fft_df['National_Oilwell_Varco_final_fft'].tolist())for num_ in [3, 6, 9, 100]: National_Oilwell_Varco_fft_list_m10= np.copy(National_Oilwell_Varco_fft_list); National_Oilwell_Varco_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(National_Oilwell_Varco_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(National_Oilwell_Varco_FT['National_Oilwell_Varco_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: National_Oilwell_Varco (close) stock prices & Fourier transforms')plt.legend()plt.show()#Newfield_Exploration_FFTNewfield_Exploration_FT = SP500_TechIndicator[['Date', 'Newfield_Exploration_Close']]Newfield_Exploration_Close_fft = np.fft.fft(np.asarray(Newfield_Exploration_FT['Newfield_Exploration_Close'].tolist()))Newfield_Exploration_fft_df = pd.DataFrame({'Newfield_Exploration_final_fft':Newfield_Exploration_Close_fft})Newfield_Exploration_fft_df['Newfield_Exploration_fft_absolute'] = Newfield_Exploration_fft_df['Newfield_Exploration_final_fft'].apply(lambda x: np.abs(x))Newfield_Exploration_fft_df['Newfield_Exploration_fft_angle'] = Newfield_Exploration_fft_df['Newfield_Exploration_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Newfield_Exploration_fft_list = np.asarray(Newfield_Exploration_fft_df['Newfield_Exploration_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Newfield_Exploration_fft_list_m10= np.copy(Newfield_Exploration_fft_list); Newfield_Exploration_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Newfield_Exploration_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Newfield_Exploration_FT['Newfield_Exploration_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Newfield_Exploration (close) stock prices & Fourier transforms')plt.legend()plt.show()#Noble_Energy_FFTNoble_Energy_FT = SP500_TechIndicator[['Date', 'Noble_Energy_Close']]Noble_Energy_Close_fft = np.fft.fft(np.asarray(Noble_Energy_FT['Noble_Energy_Close'].tolist()))Noble_Energy_fft_df = pd.DataFrame({'Noble_Energy_final_fft':Noble_Energy_Close_fft})Noble_Energy_fft_df['Noble_Energy_fft_absolute'] = Noble_Energy_fft_df['Noble_Energy_final_fft'].apply(lambda x: np.abs(x))Noble_Energy_fft_df['Noble_Energy_fft_angle'] = Noble_Energy_fft_df['Noble_Energy_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Noble_Energy_fft_list = np.asarray(Noble_Energy_fft_df['Noble_Energy_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Noble_Energy_fft_list_m10= np.copy(Noble_Energy_fft_list); Noble_Energy_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Noble_Energy_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Noble_Energy_FT['Noble_Energy_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Noble_Energy (close) stock prices & Fourier transforms')plt.legend()plt.show()#Occidental_Petroleum_FFTOccidental_Petroleum_FT = SP500_TechIndicator[['Date', 'Occidental_Petroleum_Close']]Occidental_Petroleum_Close_fft = np.fft.fft(np.asarray(Occidental_Petroleum_FT['Occidental_Petroleum_Close'].tolist()))Occidental_Petroleum_fft_df = pd.DataFrame({'Occidental_Petroleum_final_fft':Occidental_Petroleum_Close_fft})Occidental_Petroleum_fft_df['Occidental_Petroleum_fft_absolute'] = Occidental_Petroleum_fft_df['Occidental_Petroleum_final_fft'].apply(lambda x: np.abs(x))Occidental_Petroleum_fft_df['Occidental_Petroleum_fft_angle'] = Occidental_Petroleum_fft_df['Occidental_Petroleum_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Occidental_Petroleum_fft_list = np.asarray(Occidental_Petroleum_fft_df['Occidental_Petroleum_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Occidental_Petroleum_fft_list_m10= np.copy(Occidental_Petroleum_fft_list); Occidental_Petroleum_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Occidental_Petroleum_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Occidental_Petroleum_FT['Occidental_Petroleum_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Occidental_Petroleum (close) stock prices & Fourier transforms')plt.legend()plt.show()#ONEOK_FFTONEOK_FT = SP500_TechIndicator[['Date', 'ONEOK_Close']]ONEOK_Close_fft = np.fft.fft(np.asarray(ONEOK_FT['ONEOK_Close'].tolist()))ONEOK_fft_df = pd.DataFrame({'ONEOK_final_fft':ONEOK_Close_fft})ONEOK_fft_df['ONEOK_fft_absolute'] = ONEOK_fft_df['ONEOK_final_fft'].apply(lambda x: np.abs(x))ONEOK_fft_df['ONEOK_fft_angle'] = ONEOK_fft_df['ONEOK_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)ONEOK_fft_list = np.asarray(ONEOK_fft_df['ONEOK_final_fft'].tolist())for num_ in [3, 6, 9, 100]: ONEOK_fft_list_m10= np.copy(ONEOK_fft_list); ONEOK_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(ONEOK_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(ONEOK_FT['ONEOK_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: ONEOK (close) stock prices & Fourier transforms')plt.legend()plt.show()#Phillips_SixtySix_FFTPhillips_SixtySix_FT = SP500_TechIndicator[['Date', 'Phillips_SixtySix_Close']]Phillips_SixtySix_Close_fft = np.fft.fft(np.asarray(Phillips_SixtySix_FT['Phillips_SixtySix_Close'].tolist()))Phillips_SixtySix_fft_df = pd.DataFrame({'Phillips_SixtySix_final_fft':Phillips_SixtySix_Close_fft})Phillips_SixtySix_fft_df['Phillips_SixtySix_fft_absolute'] = Phillips_SixtySix_fft_df['Phillips_SixtySix_final_fft'].apply(lambda x: np.abs(x))Phillips_SixtySix_fft_df['Phillips_SixtySix_fft_angle'] = Phillips_SixtySix_fft_df['Phillips_SixtySix_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Phillips_SixtySix_fft_list = np.asarray(Phillips_SixtySix_fft_df['Phillips_SixtySix_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Phillips_SixtySix_fft_list_m10= np.copy(Phillips_SixtySix_fft_list); Phillips_SixtySix_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Phillips_SixtySix_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Phillips_SixtySix_FT['Phillips_SixtySix_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Phillips_SixtySix (close) stock prices & Fourier transforms')plt.legend()plt.show()x
#Schlumberger_FFTSchlumberger_FT = SP500_TechIndicator[['Date', 'Schlumberger_Close']]Schlumberger_Close_fft = np.fft.fft(np.asarray(Schlumberger_FT['Schlumberger_Close'].tolist()))Schlumberger_fft_df = pd.DataFrame({'Schlumberger_final_fft':Schlumberger_Close_fft})Schlumberger_fft_df['Schlumberger_fft_absolute'] = Schlumberger_fft_df['Schlumberger_final_fft'].apply(lambda x: np.abs(x))Schlumberger_fft_df['Schlumberger_fft_angle'] = Schlumberger_fft_df['Schlumberger_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Schlumberger_fft_list = np.asarray(Schlumberger_fft_df['Schlumberger_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Schlumberger_fft_list_m10= np.copy(Schlumberger_fft_list); Schlumberger_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Schlumberger_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Schlumberger_FT['Schlumberger_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Schlumberger (close) stock prices & Fourier transforms')plt.legend()plt.show()#TechnipFMC_FFTTechnipFMC_FT = SP500_TechIndicator[['Date', 'TechnipFMC_Close']]TechnipFMC_Close_fft = np.fft.fft(np.asarray(TechnipFMC_FT['TechnipFMC_Close'].tolist()))TechnipFMC_fft_df = pd.DataFrame({'TechnipFMC_final_fft':TechnipFMC_Close_fft})TechnipFMC_fft_df['TechnipFMC_fft_absolute'] = TechnipFMC_fft_df['TechnipFMC_final_fft'].apply(lambda x: np.abs(x))TechnipFMC_fft_df['TechnipFMC_fft_angle'] = TechnipFMC_fft_df['TechnipFMC_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)TechnipFMC_fft_list = np.asarray(TechnipFMC_fft_df['TechnipFMC_final_fft'].tolist())for num_ in [3, 6, 9, 100]: TechnipFMC_fft_list_m10= np.copy(TechnipFMC_fft_list); TechnipFMC_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(TechnipFMC_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(TechnipFMC_FT['TechnipFMC_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: TechnipFMC (close) stock prices & Fourier transforms')plt.legend()plt.show()#Valero_Energy_FFTValero_Energy_FT = SP500_TechIndicator[['Date', 'Valero_Energy_Close']]Valero_Energy_Close_fft = np.fft.fft(np.asarray(Valero_Energy_FT['Valero_Energy_Close'].tolist()))Valero_Energy_fft_df = pd.DataFrame({'Valero_Energy_final_fft':Valero_Energy_Close_fft})Valero_Energy_fft_df['Valero_Energy_fft_absolute'] = Valero_Energy_fft_df['Valero_Energy_final_fft'].apply(lambda x: np.abs(x))Valero_Energy_fft_df['Valero_Energy_fft_angle'] = Valero_Energy_fft_df['Valero_Energy_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Valero_Energy_fft_list = np.asarray(Valero_Energy_fft_df['Valero_Energy_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Valero_Energy_fft_list_m10= np.copy(Valero_Energy_fft_list); Valero_Energy_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Valero_Energy_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Valero_Energy_FT['Valero_Energy_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Valero_Energy (close) stock prices & Fourier transforms')plt.legend()plt.show()#Williams_Cos_FFTWilliams_Cos_FT = SP500_TechIndicator[['Date', 'Williams_Cos_Close']]Williams_Cos_Close_fft = np.fft.fft(np.asarray(Williams_Cos_FT['Williams_Cos_Close'].tolist()))Williams_Cos_fft_df = pd.DataFrame({'Williams_Cos_final_fft':Williams_Cos_Close_fft})Williams_Cos_fft_df['Williams_Cos_fft_absolute'] = Williams_Cos_fft_df['Williams_Cos_final_fft'].apply(lambda x: np.abs(x))Williams_Cos_fft_df['Williams_Cos_fft_angle'] = Williams_Cos_fft_df['Williams_Cos_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Williams_Cos_fft_list = np.asarray(Williams_Cos_fft_df['Williams_Cos_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Williams_Cos_fft_list_m10= np.copy(Williams_Cos_fft_list); Williams_Cos_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Williams_Cos_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Williams_Cos_FT['Williams_Cos_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Williams_Cos (close) stock prices & Fourier transforms')plt.legend()plt.show()#Affiliated_Managers_Group_FFTAffiliated_Managers_Group_FT = SP500_TechIndicator[['Date', 'Affiliated_Managers_Group_Close']]Affiliated_Managers_Group_Close_fft = np.fft.fft(np.asarray(Affiliated_Managers_Group_FT['Affiliated_Managers_Group_Close'].tolist()))Affiliated_Managers_Group_fft_df = pd.DataFrame({'Affiliated_Managers_Group_final_fft':Affiliated_Managers_Group_Close_fft})Affiliated_Managers_Group_fft_df['Affiliated_Managers_Group_fft_absolute'] = Affiliated_Managers_Group_fft_df['Affiliated_Managers_Group_final_fft'].apply(lambda x: np.abs(x))Affiliated_Managers_Group_fft_df['Affiliated_Managers_Group_fft_angle'] = Affiliated_Managers_Group_fft_df['Affiliated_Managers_Group_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Affiliated_Managers_Group_fft_list = np.asarray(Affiliated_Managers_Group_fft_df['Affiliated_Managers_Group_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Affiliated_Managers_Group_fft_list_m10= np.copy(Affiliated_Managers_Group_fft_list); Affiliated_Managers_Group_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Affiliated_Managers_Group_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Affiliated_Managers_Group_FT['Affiliated_Managers_Group_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Affiliated_Managers_Group (close) stock prices & Fourier transforms')plt.legend()plt.show()#AFLAC_FFTAFLAC_FT = SP500_TechIndicator[['Date', 'AFLAC_Close']]AFLAC_Close_fft = np.fft.fft(np.asarray(AFLAC_FT['AFLAC_Close'].tolist()))AFLAC_fft_df = pd.DataFrame({'AFLAC_final_fft':AFLAC_Close_fft})AFLAC_fft_df['AFLAC_fft_absolute'] = AFLAC_fft_df['AFLAC_final_fft'].apply(lambda x: np.abs(x))AFLAC_fft_df['AFLAC_fft_angle'] = AFLAC_fft_df['AFLAC_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)AFLAC_fft_list = np.asarray(AFLAC_fft_df['AFLAC_final_fft'].tolist())for num_ in [3, 6, 9, 100]: AFLAC_fft_list_m10= np.copy(AFLAC_fft_list); AFLAC_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(AFLAC_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(AFLAC_FT['AFLAC_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: AFLAC (close) stock prices & Fourier transforms')plt.legend()plt.show()#Allstate_Corp_FFTAllstate_Corp_FT = SP500_TechIndicator[['Date', 'Allstate_Corp_Close']]Allstate_Corp_Close_fft = np.fft.fft(np.asarray(Allstate_Corp_FT['Allstate_Corp_Close'].tolist()))Allstate_Corp_fft_df = pd.DataFrame({'Allstate_Corp_final_fft':Allstate_Corp_Close_fft})Allstate_Corp_fft_df['Allstate_Corp_fft_absolute'] = Allstate_Corp_fft_df['Allstate_Corp_final_fft'].apply(lambda x: np.abs(x))Allstate_Corp_fft_df['Allstate_Corp_fft_angle'] = Allstate_Corp_fft_df['Allstate_Corp_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Allstate_Corp_fft_list = np.asarray(Allstate_Corp_fft_df['Allstate_Corp_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Allstate_Corp_fft_list_m10= np.copy(Allstate_Corp_fft_list); Allstate_Corp_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Allstate_Corp_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Allstate_Corp_FT['Allstate_Corp_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Allstate_Corp (close) stock prices & Fourier transforms')plt.legend()plt.show()#American_Express_FFTAmerican_Express_FT = SP500_TechIndicator[['Date', 'American_Express_Close']]American_Express_Close_fft = np.fft.fft(np.asarray(American_Express_FT['American_Express_Close'].tolist()))American_Express_fft_df = pd.DataFrame({'American_Express_final_fft':American_Express_Close_fft})American_Express_fft_df['American_Express_fft_absolute'] = American_Express_fft_df['American_Express_final_fft'].apply(lambda x: np.abs(x))American_Express_fft_df['American_Express_fft_angle'] = American_Express_fft_df['American_Express_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)American_Express_fft_list = np.asarray(American_Express_fft_df['American_Express_final_fft'].tolist())for num_ in [3, 6, 9, 100]: American_Express_fft_list_m10= np.copy(American_Express_fft_list); American_Express_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(American_Express_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(American_Express_FT['American_Express_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: American_Express (close) stock prices & Fourier transforms')plt.legend()plt.show()#American_International_Group_FFTAmerican_International_Group_FT = SP500_TechIndicator[['Date', 'American_International_Group_Close']]American_International_Group_Close_fft = np.fft.fft(np.asarray(American_International_Group_FT['American_International_Group_Close'].tolist()))American_International_Group_fft_df = pd.DataFrame({'American_International_Group_final_fft':American_International_Group_Close_fft})American_International_Group_fft_df['American_International_Group_fft_absolute'] = American_International_Group_fft_df['American_International_Group_final_fft'].apply(lambda x: np.abs(x))American_International_Group_fft_df['American_International_Group_fft_angle'] = American_International_Group_fft_df['American_International_Group_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)American_International_Group_fft_list = np.asarray(American_International_Group_fft_df['American_International_Group_final_fft'].tolist())for num_ in [3, 6, 9, 100]: American_International_Group_fft_list_m10= np.copy(American_International_Group_fft_list); American_International_Group_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(American_International_Group_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(American_International_Group_FT['American_International_Group_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: American_International_Group (close) stock prices & Fourier transforms')plt.legend()plt.show()#Ameriprise_Financial_FFTAmeriprise_Financial_FT = SP500_TechIndicator[['Date', 'Ameriprise_Financial_Close']]Ameriprise_Financial_Close_fft = np.fft.fft(np.asarray(Ameriprise_Financial_FT['Ameriprise_Financial_Close'].tolist()))Ameriprise_Financial_fft_df = pd.DataFrame({'Ameriprise_Financial_final_fft':Ameriprise_Financial_Close_fft})Ameriprise_Financial_fft_df['Ameriprise_Financial_fft_absolute'] = Ameriprise_Financial_fft_df['Ameriprise_Financial_final_fft'].apply(lambda x: np.abs(x))Ameriprise_Financial_fft_df['Ameriprise_Financial_fft_angle'] = Ameriprise_Financial_fft_df['Ameriprise_Financial_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Ameriprise_Financial_fft_list = np.asarray(Ameriprise_Financial_fft_df['Ameriprise_Financial_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Ameriprise_Financial_fft_list_m10= np.copy(Ameriprise_Financial_fft_list); Ameriprise_Financial_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Ameriprise_Financial_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Ameriprise_Financial_FT['Ameriprise_Financial_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Ameriprise_Financial (close) stock prices & Fourier transforms')plt.legend()plt.show()#Aon_FFTAon_FT = SP500_TechIndicator[['Date', 'Aon_Close']]Aon_Close_fft = np.fft.fft(np.asarray(Aon_FT['Aon_Close'].tolist()))Aon_fft_df = pd.DataFrame({'Aon_final_fft':Aon_Close_fft})Aon_fft_df['Aon_fft_absolute'] = Aon_fft_df['Aon_final_fft'].apply(lambda x: np.abs(x))Aon_fft_df['Aon_fft_angle'] = Aon_fft_df['Aon_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Aon_fft_list = np.asarray(Aon_fft_df['Aon_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Aon_fft_list_m10= np.copy(Aon_fft_list); Aon_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Aon_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Aon_FT['Aon_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Aon (close) stock prices & Fourier transforms')plt.legend()plt.show()#Arthur_J_Gallagher_FFTArthur_J_Gallagher_FT = SP500_TechIndicator[['Date', 'Arthur_J_Gallagher_Close']]Arthur_J_Gallagher_Close_fft = np.fft.fft(np.asarray(Arthur_J_Gallagher_FT['Arthur_J_Gallagher_Close'].tolist()))Arthur_J_Gallagher_fft_df = pd.DataFrame({'Arthur_J_Gallagher_final_fft':Arthur_J_Gallagher_Close_fft})Arthur_J_Gallagher_fft_df['Arthur_J_Gallagher_fft_absolute'] = Arthur_J_Gallagher_fft_df['Arthur_J_Gallagher_final_fft'].apply(lambda x: np.abs(x))Arthur_J_Gallagher_fft_df['Arthur_J_Gallagher_fft_angle'] = Arthur_J_Gallagher_fft_df['Arthur_J_Gallagher_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Arthur_J_Gallagher_fft_list = np.asarray(Arthur_J_Gallagher_fft_df['Arthur_J_Gallagher_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Arthur_J_Gallagher_fft_list_m10= np.copy(Arthur_J_Gallagher_fft_list); Arthur_J_Gallagher_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Arthur_J_Gallagher_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Arthur_J_Gallagher_FT['Arthur_J_Gallagher_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Arthur_J_Gallagher (close) stock prices & Fourier transforms')plt.legend()plt.show()#Assurant_FFTAssurant_FT = SP500_TechIndicator[['Date', 'Assurant_Close']]Assurant_Close_fft = np.fft.fft(np.asarray(Assurant_FT['Assurant_Close'].tolist()))Assurant_fft_df = pd.DataFrame({'Assurant_final_fft':Assurant_Close_fft})Assurant_fft_df['Assurant_fft_absolute'] = Assurant_fft_df['Assurant_final_fft'].apply(lambda x: np.abs(x))Assurant_fft_df['Assurant_fft_angle'] = Assurant_fft_df['Assurant_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Assurant_fft_list = np.asarray(Assurant_fft_df['Assurant_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Assurant_fft_list_m10= np.copy(Assurant_fft_list); Assurant_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Assurant_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Assurant_FT['Assurant_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Assurant (close) stock prices & Fourier transforms')plt.legend()plt.show()#Bank_of_America_FFTBank_of_America_FT = SP500_TechIndicator[['Date', 'Bank_of_America_Close']]Bank_of_America_Close_fft = np.fft.fft(np.asarray(Bank_of_America_FT['Bank_of_America_Close'].tolist()))Bank_of_America_fft_df = pd.DataFrame({'Bank_of_America_final_fft':Bank_of_America_Close_fft})Bank_of_America_fft_df['Bank_of_America_fft_absolute'] = Bank_of_America_fft_df['Bank_of_America_final_fft'].apply(lambda x: np.abs(x))Bank_of_America_fft_df['Bank_of_America_fft_angle'] = Bank_of_America_fft_df['Bank_of_America_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Bank_of_America_fft_list = np.asarray(Bank_of_America_fft_df['Bank_of_America_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Bank_of_America_fft_list_m10= np.copy(Bank_of_America_fft_list); Bank_of_America_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Bank_of_America_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Bank_of_America_FT['Bank_of_America_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Bank_of_America (close) stock prices & Fourier transforms')plt.legend()plt.show()#The_Bank_of_NewYork_FFTThe_Bank_of_NewYork_FT = SP500_TechIndicator[['Date', 'The_Bank_of_NewYork_Close']]The_Bank_of_NewYork_Close_fft = np.fft.fft(np.asarray(The_Bank_of_NewYork_FT['The_Bank_of_NewYork_Close'].tolist()))The_Bank_of_NewYork_fft_df = pd.DataFrame({'The_Bank_of_NewYork_final_fft':The_Bank_of_NewYork_Close_fft})The_Bank_of_NewYork_fft_df['The_Bank_of_NewYork_fft_absolute'] = The_Bank_of_NewYork_fft_df['The_Bank_of_NewYork_final_fft'].apply(lambda x: np.abs(x))The_Bank_of_NewYork_fft_df['The_Bank_of_NewYork_fft_angle'] = The_Bank_of_NewYork_fft_df['The_Bank_of_NewYork_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)The_Bank_of_NewYork_fft_list = np.asarray(The_Bank_of_NewYork_fft_df['The_Bank_of_NewYork_final_fft'].tolist())for num_ in [3, 6, 9, 100]: The_Bank_of_NewYork_fft_list_m10= np.copy(The_Bank_of_NewYork_fft_list); The_Bank_of_NewYork_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(The_Bank_of_NewYork_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(The_Bank_of_NewYork_FT['The_Bank_of_NewYork_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: The_Bank_of_NewYork (close) stock prices & Fourier transforms')plt.legend()plt.show()#BBT_FFTBBT_FT = SP500_TechIndicator[['Date', 'BBT_Close']]BBT_Close_fft = np.fft.fft(np.asarray(BBT_FT['BBT_Close'].tolist()))BBT_fft_df = pd.DataFrame({'BBT_final_fft':BBT_Close_fft})BBT_fft_df['BBT_fft_absolute'] = BBT_fft_df['BBT_final_fft'].apply(lambda x: np.abs(x))BBT_fft_df['BBT_fft_angle'] = BBT_fft_df['BBT_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)BBT_fft_list = np.asarray(BBT_fft_df['BBT_final_fft'].tolist())for num_ in [3, 6, 9, 100]: BBT_fft_list_m10= np.copy(BBT_fft_list); BBT_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(BBT_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(BBT_FT['BBT_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: BBT (close) stock prices & Fourier transforms')plt.legend()plt.show()#Berkshire_Hathaway_FFTBerkshire_Hathaway_FT = SP500_TechIndicator[['Date', 'Berkshire_Hathaway_Close']]Berkshire_Hathaway_Close_fft = np.fft.fft(np.asarray(Berkshire_Hathaway_FT['Berkshire_Hathaway_Close'].tolist()))Berkshire_Hathaway_fft_df = pd.DataFrame({'Berkshire_Hathaway_final_fft':Berkshire_Hathaway_Close_fft})Berkshire_Hathaway_fft_df['Berkshire_Hathaway_fft_absolute'] = Berkshire_Hathaway_fft_df['Berkshire_Hathaway_final_fft'].apply(lambda x: np.abs(x))Berkshire_Hathaway_fft_df['Berkshire_Hathaway_fft_angle'] = Berkshire_Hathaway_fft_df['Berkshire_Hathaway_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Berkshire_Hathaway_fft_list = np.asarray(Berkshire_Hathaway_fft_df['Berkshire_Hathaway_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Berkshire_Hathaway_fft_list_m10= np.copy(Berkshire_Hathaway_fft_list); Berkshire_Hathaway_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Berkshire_Hathaway_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Berkshire_Hathaway_FT['Berkshire_Hathaway_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Berkshire_Hathaway (close) stock prices & Fourier transforms')plt.legend()plt.show()#BlackRock_FFTBlackRock_FT = SP500_TechIndicator[['Date', 'BlackRock_Close']]BlackRock_Close_fft = np.fft.fft(np.asarray(BlackRock_FT['BlackRock_Close'].tolist()))BlackRock_fft_df = pd.DataFrame({'BlackRock_final_fft':BlackRock_Close_fft})BlackRock_fft_df['BlackRock_fft_absolute'] = BlackRock_fft_df['BlackRock_final_fft'].apply(lambda x: np.abs(x))BlackRock_fft_df['BlackRock_fft_angle'] = BlackRock_fft_df['BlackRock_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)BlackRock_fft_list = np.asarray(BlackRock_fft_df['BlackRock_final_fft'].tolist())for num_ in [3, 6, 9, 100]: BlackRock_fft_list_m10= np.copy(BlackRock_fft_list); BlackRock_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(BlackRock_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(BlackRock_FT['BlackRock_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: BlackRock (close) stock prices & Fourier transforms')plt.legend()plt.show()x
#Capital_One_Financial_FFTCapital_One_Financial_FT = SP500_TechIndicator[['Date', 'Capital_One_Financial_Close']]Capital_One_Financial_Close_fft = np.fft.fft(np.asarray(Capital_One_Financial_FT['Capital_One_Financial_Close'].tolist()))Capital_One_Financial_fft_df = pd.DataFrame({'Capital_One_Financial_final_fft':Capital_One_Financial_Close_fft})Capital_One_Financial_fft_df['Capital_One_Financial_fft_absolute'] = Capital_One_Financial_fft_df['Capital_One_Financial_final_fft'].apply(lambda x: np.abs(x))Capital_One_Financial_fft_df['Capital_One_Financial_fft_angle'] = Capital_One_Financial_fft_df['Capital_One_Financial_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Capital_One_Financial_fft_list = np.asarray(Capital_One_Financial_fft_df['Capital_One_Financial_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Capital_One_Financial_fft_list_m10= np.copy(Capital_One_Financial_fft_list); Capital_One_Financial_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Capital_One_Financial_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Capital_One_Financial_FT['Capital_One_Financial_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Capital_One_Financial (close) stock prices & Fourier transforms')plt.legend()plt.show()#Cboe_Global_Markets_FFTCboe_Global_Markets_FT = SP500_TechIndicator[['Date', 'Cboe_Global_Markets_Close']]Cboe_Global_Markets_Close_fft = np.fft.fft(np.asarray(Cboe_Global_Markets_FT['Cboe_Global_Markets_Close'].tolist()))Cboe_Global_Markets_fft_df = pd.DataFrame({'Cboe_Global_Markets_final_fft':Cboe_Global_Markets_Close_fft})Cboe_Global_Markets_fft_df['Cboe_Global_Markets_fft_absolute'] = Cboe_Global_Markets_fft_df['Cboe_Global_Markets_final_fft'].apply(lambda x: np.abs(x))Cboe_Global_Markets_fft_df['Cboe_Global_Markets_fft_angle'] = Cboe_Global_Markets_fft_df['Cboe_Global_Markets_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Cboe_Global_Markets_fft_list = np.asarray(Cboe_Global_Markets_fft_df['Cboe_Global_Markets_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Cboe_Global_Markets_fft_list_m10= np.copy(Cboe_Global_Markets_fft_list); Cboe_Global_Markets_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Cboe_Global_Markets_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Cboe_Global_Markets_FT['Cboe_Global_Markets_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Cboe_Global_Markets (close) stock prices & Fourier transforms')plt.legend()plt.show()#Charles_Schwab_Corporation_FFTCharles_Schwab_Corporation_FT = SP500_TechIndicator[['Date', 'Charles_Schwab_Corporation_Close']]Charles_Schwab_Corporation_Close_fft = np.fft.fft(np.asarray(Charles_Schwab_Corporation_FT['Charles_Schwab_Corporation_Close'].tolist()))Charles_Schwab_Corporation_fft_df = pd.DataFrame({'Charles_Schwab_Corporation_final_fft':Charles_Schwab_Corporation_Close_fft})Charles_Schwab_Corporation_fft_df['Charles_Schwab_Corporation_fft_absolute'] = Charles_Schwab_Corporation_fft_df['Charles_Schwab_Corporation_final_fft'].apply(lambda x: np.abs(x))Charles_Schwab_Corporation_fft_df['Charles_Schwab_Corporation_fft_angle'] = Charles_Schwab_Corporation_fft_df['Charles_Schwab_Corporation_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Charles_Schwab_Corporation_fft_list = np.asarray(Charles_Schwab_Corporation_fft_df['Charles_Schwab_Corporation_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Charles_Schwab_Corporation_fft_list_m10= np.copy(Charles_Schwab_Corporation_fft_list); Charles_Schwab_Corporation_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Charles_Schwab_Corporation_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Charles_Schwab_Corporation_FT['Charles_Schwab_Corporation_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Charles_Schwab_Corporation (close) stock prices & Fourier transforms')plt.legend()plt.show()#Chubb_FFTChubb_FT = SP500_TechIndicator[['Date', 'Chubb_Close']]Chubb_Close_fft = np.fft.fft(np.asarray(Chubb_FT['Chubb_Close'].tolist()))Chubb_fft_df = pd.DataFrame({'Chubb_final_fft':Chubb_Close_fft})Chubb_fft_df['Chubb_fft_absolute'] = Chubb_fft_df['Chubb_final_fft'].apply(lambda x: np.abs(x))Chubb_fft_df['Chubb_fft_angle'] = Chubb_fft_df['Chubb_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Chubb_fft_list = np.asarray(Chubb_fft_df['Chubb_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Chubb_fft_list_m10= np.copy(Chubb_fft_list); Chubb_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Chubb_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Chubb_FT['Chubb_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Chubb (close) stock prices & Fourier transforms')plt.legend()plt.show()#Cincinnati_Financial_FFTCincinnati_Financial_FT = SP500_TechIndicator[['Date', 'Cincinnati_Financial_Close']]Cincinnati_Financial_Close_fft = np.fft.fft(np.asarray(Cincinnati_Financial_FT['Cincinnati_Financial_Close'].tolist()))Cincinnati_Financial_fft_df = pd.DataFrame({'Cincinnati_Financial_final_fft':Cincinnati_Financial_Close_fft})Cincinnati_Financial_fft_df['Cincinnati_Financial_fft_absolute'] = Cincinnati_Financial_fft_df['Cincinnati_Financial_final_fft'].apply(lambda x: np.abs(x))Cincinnati_Financial_fft_df['Cincinnati_Financial_fft_angle'] = Cincinnati_Financial_fft_df['Cincinnati_Financial_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Cincinnati_Financial_fft_list = np.asarray(Cincinnati_Financial_fft_df['Cincinnati_Financial_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Cincinnati_Financial_fft_list_m10= np.copy(Cincinnati_Financial_fft_list); Cincinnati_Financial_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Cincinnati_Financial_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Cincinnati_Financial_FT['Cincinnati_Financial_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Cincinnati_Financial (close) stock prices & Fourier transforms')plt.legend()plt.show()#Citigroup_FFTCitigroup_FT = SP500_TechIndicator[['Date', 'Citigroup_Close']]Citigroup_Close_fft = np.fft.fft(np.asarray(Citigroup_FT['Citigroup_Close'].tolist()))Citigroup_fft_df = pd.DataFrame({'Citigroup_final_fft':Citigroup_Close_fft})Citigroup_fft_df['Citigroup_fft_absolute'] = Citigroup_fft_df['Citigroup_final_fft'].apply(lambda x: np.abs(x))Citigroup_fft_df['Citigroup_fft_angle'] = Citigroup_fft_df['Citigroup_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Citigroup_fft_list = np.asarray(Citigroup_fft_df['Citigroup_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Citigroup_fft_list_m10= np.copy(Citigroup_fft_list); Citigroup_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Citigroup_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Citigroup_FT['Citigroup_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Citigroup (close) stock prices & Fourier transforms')plt.legend()plt.show()x
#CME_Group_FFTCME_Group_FT = SP500_TechIndicator[['Date', 'CME_Group_Close']]CME_Group_Close_fft = np.fft.fft(np.asarray(CME_Group_FT['CME_Group_Close'].tolist()))CME_Group_fft_df = pd.DataFrame({'CME_Group_final_fft':CME_Group_Close_fft})CME_Group_fft_df['CME_Group_fft_absolute'] = CME_Group_fft_df['CME_Group_final_fft'].apply(lambda x: np.abs(x))CME_Group_fft_df['CME_Group_fft_angle'] = CME_Group_fft_df['CME_Group_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)CME_Group_fft_list = np.asarray(CME_Group_fft_df['CME_Group_final_fft'].tolist())for num_ in [3, 6, 9, 100]: CME_Group_fft_list_m10= np.copy(CME_Group_fft_list); CME_Group_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(CME_Group_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(CME_Group_FT['CME_Group_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: CME_Group (close) stock prices & Fourier transforms')plt.legend()plt.show()#Comerica_FFTComerica_FT = SP500_TechIndicator[['Date', 'Comerica_Close']]Comerica_Close_fft = np.fft.fft(np.asarray(Comerica_FT['Comerica_Close'].tolist()))Comerica_fft_df = pd.DataFrame({'Comerica_final_fft':Comerica_Close_fft})Comerica_fft_df['Comerica_fft_absolute'] = Comerica_fft_df['Comerica_final_fft'].apply(lambda x: np.abs(x))Comerica_fft_df['Comerica_fft_angle'] = Comerica_fft_df['Comerica_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Comerica_fft_list = np.asarray(Comerica_fft_df['Comerica_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Comerica_fft_list_m10= np.copy(Comerica_fft_list); Comerica_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Comerica_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Comerica_FT['Comerica_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Comerica (close) stock prices & Fourier transforms')plt.legend()plt.show()#Discover_Financial_Services_FFTDiscover_Financial_Services_FT = SP500_TechIndicator[['Date', 'Discover_Financial_Services_Close']]Discover_Financial_Services_Close_fft = np.fft.fft(np.asarray(Discover_Financial_Services_FT['Discover_Financial_Services_Close'].tolist()))Discover_Financial_Services_fft_df = pd.DataFrame({'Discover_Financial_Services_final_fft':Discover_Financial_Services_Close_fft})Discover_Financial_Services_fft_df['Discover_Financial_Services_fft_absolute'] = Discover_Financial_Services_fft_df['Discover_Financial_Services_final_fft'].apply(lambda x: np.abs(x))Discover_Financial_Services_fft_df['Discover_Financial_Services_fft_angle'] = Discover_Financial_Services_fft_df['Discover_Financial_Services_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Discover_Financial_Services_fft_list = np.asarray(Discover_Financial_Services_fft_df['Discover_Financial_Services_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Discover_Financial_Services_fft_list_m10= np.copy(Discover_Financial_Services_fft_list); Discover_Financial_Services_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Discover_Financial_Services_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Discover_Financial_Services_FT['Discover_Financial_Services_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Discover_Financial_Services (close) stock prices & Fourier transforms')plt.legend()plt.show()#ETrade_FFTETrade_FT = SP500_TechIndicator[['Date', 'ETrade_Close']]ETrade_Close_fft = np.fft.fft(np.asarray(ETrade_FT['ETrade_Close'].tolist()))ETrade_fft_df = pd.DataFrame({'ETrade_final_fft':ETrade_Close_fft})ETrade_fft_df['ETrade_fft_absolute'] = ETrade_fft_df['ETrade_final_fft'].apply(lambda x: np.abs(x))ETrade_fft_df['ETrade_fft_angle'] = ETrade_fft_df['ETrade_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)ETrade_fft_list = np.asarray(ETrade_fft_df['ETrade_final_fft'].tolist())for num_ in [3, 6, 9, 100]: ETrade_fft_list_m10= np.copy(ETrade_fft_list); ETrade_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(ETrade_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(ETrade_FT['ETrade_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: ETrade (close) stock prices & Fourier transforms')plt.legend()plt.show()#Everest_Re_Group_FFTEverest_Re_Group_FT = SP500_TechIndicator[['Date', 'Everest_Re_Group_Close']]Everest_Re_Group_Close_fft = np.fft.fft(np.asarray(Everest_Re_Group_FT['Everest_Re_Group_Close'].tolist()))Everest_Re_Group_fft_df = pd.DataFrame({'Everest_Re_Group_final_fft':Everest_Re_Group_Close_fft})Everest_Re_Group_fft_df['Everest_Re_Group_fft_absolute'] = Everest_Re_Group_fft_df['Everest_Re_Group_final_fft'].apply(lambda x: np.abs(x))Everest_Re_Group_fft_df['Everest_Re_Group_fft_angle'] = Everest_Re_Group_fft_df['Everest_Re_Group_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Everest_Re_Group_fft_list = np.asarray(Everest_Re_Group_fft_df['Everest_Re_Group_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Everest_Re_Group_fft_list_m10= np.copy(Everest_Re_Group_fft_list); Everest_Re_Group_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Everest_Re_Group_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Everest_Re_Group_FT['Everest_Re_Group_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Everest_Re_Group (close) stock prices & Fourier transforms')plt.legend()plt.show()#Fifth_Third_Bancorp_FFTFifth_Third_Bancorp_FT = SP500_TechIndicator[['Date', 'Fifth_Third_Bancorp_Close']]Fifth_Third_Bancorp_Close_fft = np.fft.fft(np.asarray(Fifth_Third_Bancorp_FT['Fifth_Third_Bancorp_Close'].tolist()))Fifth_Third_Bancorp_fft_df = pd.DataFrame({'Fifth_Third_Bancorp_final_fft':Fifth_Third_Bancorp_Close_fft})Fifth_Third_Bancorp_fft_df['Fifth_Third_Bancorp_fft_absolute'] = Fifth_Third_Bancorp_fft_df['Fifth_Third_Bancorp_final_fft'].apply(lambda x: np.abs(x))Fifth_Third_Bancorp_fft_df['Fifth_Third_Bancorp_fft_angle'] = Fifth_Third_Bancorp_fft_df['Fifth_Third_Bancorp_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Fifth_Third_Bancorp_fft_list = np.asarray(Fifth_Third_Bancorp_fft_df['Fifth_Third_Bancorp_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Fifth_Third_Bancorp_fft_list_m10= np.copy(Fifth_Third_Bancorp_fft_list); Fifth_Third_Bancorp_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Fifth_Third_Bancorp_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Fifth_Third_Bancorp_FT['Fifth_Third_Bancorp_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Fifth_Third_Bancorp (close) stock prices & Fourier transforms')plt.legend()plt.show()#First_Republic_Bank_FFTFirst_Republic_Bank_FT = SP500_TechIndicator[['Date', 'First_Republic_Bank_Close']]First_Republic_Bank_Close_fft = np.fft.fft(np.asarray(First_Republic_Bank_FT['First_Republic_Bank_Close'].tolist()))First_Republic_Bank_fft_df = pd.DataFrame({'First_Republic_Bank_final_fft':First_Republic_Bank_Close_fft})First_Republic_Bank_fft_df['First_Republic_Bank_fft_absolute'] = First_Republic_Bank_fft_df['First_Republic_Bank_final_fft'].apply(lambda x: np.abs(x))First_Republic_Bank_fft_df['First_Republic_Bank_fft_angle'] = First_Republic_Bank_fft_df['First_Republic_Bank_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)First_Republic_Bank_fft_list = np.asarray(First_Republic_Bank_fft_df['First_Republic_Bank_final_fft'].tolist())for num_ in [3, 6, 9, 100]: First_Republic_Bank_fft_list_m10= np.copy(First_Republic_Bank_fft_list); First_Republic_Bank_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(First_Republic_Bank_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(First_Republic_Bank_FT['First_Republic_Bank_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: First_Republic_Bank (close) stock prices & Fourier transforms')plt.legend()plt.show()#Franklin_Resources_FFTFranklin_Resources_FT = SP500_TechIndicator[['Date', 'Franklin_Resources_Close']]Franklin_Resources_Close_fft = np.fft.fft(np.asarray(Franklin_Resources_FT['Franklin_Resources_Close'].tolist()))Franklin_Resources_fft_df = pd.DataFrame({'Franklin_Resources_final_fft':Franklin_Resources_Close_fft})Franklin_Resources_fft_df['Franklin_Resources_fft_absolute'] = Franklin_Resources_fft_df['Franklin_Resources_final_fft'].apply(lambda x: np.abs(x))Franklin_Resources_fft_df['Franklin_Resources_fft_angle'] = Franklin_Resources_fft_df['Franklin_Resources_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Franklin_Resources_fft_list = np.asarray(Franklin_Resources_fft_df['Franklin_Resources_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Franklin_Resources_fft_list_m10= np.copy(Franklin_Resources_fft_list); Franklin_Resources_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Franklin_Resources_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Franklin_Resources_FT['Franklin_Resources_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Franklin_Resources (close) stock prices & Fourier transforms')plt.legend()plt.show()#Goldman_Sachs_Group_FFTGoldman_Sachs_Group_FT = SP500_TechIndicator[['Date', 'Goldman_Sachs_Group_Close']]Goldman_Sachs_Group_Close_fft = np.fft.fft(np.asarray(Goldman_Sachs_Group_FT['Goldman_Sachs_Group_Close'].tolist()))Goldman_Sachs_Group_fft_df = pd.DataFrame({'Goldman_Sachs_Group_final_fft':Goldman_Sachs_Group_Close_fft})Goldman_Sachs_Group_fft_df['Goldman_Sachs_Group_fft_absolute'] = Goldman_Sachs_Group_fft_df['Goldman_Sachs_Group_final_fft'].apply(lambda x: np.abs(x))Goldman_Sachs_Group_fft_df['Goldman_Sachs_Group_fft_angle'] = Goldman_Sachs_Group_fft_df['Goldman_Sachs_Group_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Goldman_Sachs_Group_fft_list = np.asarray(Goldman_Sachs_Group_fft_df['Goldman_Sachs_Group_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Goldman_Sachs_Group_fft_list_m10= np.copy(Goldman_Sachs_Group_fft_list); Goldman_Sachs_Group_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Goldman_Sachs_Group_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Goldman_Sachs_Group_FT['Goldman_Sachs_Group_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Goldman_Sachs_Group (close) stock prices & Fourier transforms')plt.legend()plt.show()#Hartford_Financial_FFTHartford_Financial_FT = SP500_TechIndicator[['Date', 'Hartford_Financial_Close']]Hartford_Financial_Close_fft = np.fft.fft(np.asarray(Hartford_Financial_FT['Hartford_Financial_Close'].tolist()))Hartford_Financial_fft_df = pd.DataFrame({'Hartford_Financial_final_fft':Hartford_Financial_Close_fft})Hartford_Financial_fft_df['Hartford_Financial_fft_absolute'] = Hartford_Financial_fft_df['Hartford_Financial_final_fft'].apply(lambda x: np.abs(x))Hartford_Financial_fft_df['Hartford_Financial_fft_angle'] = Hartford_Financial_fft_df['Hartford_Financial_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Hartford_Financial_fft_list = np.asarray(Hartford_Financial_fft_df['Hartford_Financial_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Hartford_Financial_fft_list_m10= np.copy(Hartford_Financial_fft_list); Hartford_Financial_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Hartford_Financial_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Hartford_Financial_FT['Hartford_Financial_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Hartford_Financial (close) stock prices & Fourier transforms')plt.legend()plt.show()#Huntington_Bancshares_FFTHuntington_Bancshares_FT = SP500_TechIndicator[['Date', 'Huntington_Bancshares_Close']]Huntington_Bancshares_Close_fft = np.fft.fft(np.asarray(Huntington_Bancshares_FT['Huntington_Bancshares_Close'].tolist()))Huntington_Bancshares_fft_df = pd.DataFrame({'Huntington_Bancshares_final_fft':Huntington_Bancshares_Close_fft})Huntington_Bancshares_fft_df['Huntington_Bancshares_fft_absolute'] = Huntington_Bancshares_fft_df['Huntington_Bancshares_final_fft'].apply(lambda x: np.abs(x))Huntington_Bancshares_fft_df['Huntington_Bancshares_fft_angle'] = Huntington_Bancshares_fft_df['Huntington_Bancshares_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Huntington_Bancshares_fft_list = np.asarray(Huntington_Bancshares_fft_df['Huntington_Bancshares_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Huntington_Bancshares_fft_list_m10= np.copy(Huntington_Bancshares_fft_list); Huntington_Bancshares_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Huntington_Bancshares_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Huntington_Bancshares_FT['Huntington_Bancshares_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Huntington_Bancshares (close) stock prices & Fourier transforms')plt.legend()plt.show()#Intercontinental_Exchange_FFTIntercontinental_Exchange_FT = SP500_TechIndicator[['Date', 'Intercontinental_Exchange_Close']]Intercontinental_Exchange_Close_fft = np.fft.fft(np.asarray(Intercontinental_Exchange_FT['Intercontinental_Exchange_Close'].tolist()))Intercontinental_Exchange_fft_df = pd.DataFrame({'Intercontinental_Exchange_final_fft':Intercontinental_Exchange_Close_fft})Intercontinental_Exchange_fft_df['Intercontinental_Exchange_fft_absolute'] = Intercontinental_Exchange_fft_df['Intercontinental_Exchange_final_fft'].apply(lambda x: np.abs(x))Intercontinental_Exchange_fft_df['Intercontinental_Exchange_fft_angle'] = Intercontinental_Exchange_fft_df['Intercontinental_Exchange_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Intercontinental_Exchange_fft_list = np.asarray(Intercontinental_Exchange_fft_df['Intercontinental_Exchange_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Intercontinental_Exchange_fft_list_m10= np.copy(Intercontinental_Exchange_fft_list); Intercontinental_Exchange_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Intercontinental_Exchange_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Intercontinental_Exchange_FT['Intercontinental_Exchange_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Intercontinental_Exchange (close) stock prices & Fourier transforms')plt.legend()plt.show()#Invesco_FFTInvesco_FT = SP500_TechIndicator[['Date', 'Invesco_Close']]Invesco_Close_fft = np.fft.fft(np.asarray(Invesco_FT['Invesco_Close'].tolist()))Invesco_fft_df = pd.DataFrame({'Invesco_final_fft':Invesco_Close_fft})Invesco_fft_df['Invesco_fft_absolute'] = Invesco_fft_df['Invesco_final_fft'].apply(lambda x: np.abs(x))Invesco_fft_df['Invesco_fft_angle'] = Invesco_fft_df['Invesco_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Invesco_fft_list = np.asarray(Invesco_fft_df['Invesco_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Invesco_fft_list_m10= np.copy(Invesco_fft_list); Invesco_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Invesco_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Invesco_FT['Invesco_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Invesco (close) stock prices & Fourier transforms')plt.legend()plt.show()#JPMorgan_Chase_FFTJPMorgan_Chase_FT = SP500_TechIndicator[['Date', 'JPMorgan_Chase_Close']]JPMorgan_Chase_Close_fft = np.fft.fft(np.asarray(JPMorgan_Chase_FT['JPMorgan_Chase_Close'].tolist()))JPMorgan_Chase_fft_df = pd.DataFrame({'JPMorgan_Chase_final_fft':JPMorgan_Chase_Close_fft})JPMorgan_Chase_fft_df['JPMorgan_Chase_fft_absolute'] = JPMorgan_Chase_fft_df['JPMorgan_Chase_final_fft'].apply(lambda x: np.abs(x))JPMorgan_Chase_fft_df['JPMorgan_Chase_fft_angle'] = JPMorgan_Chase_fft_df['JPMorgan_Chase_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)JPMorgan_Chase_fft_list = np.asarray(JPMorgan_Chase_fft_df['JPMorgan_Chase_final_fft'].tolist())for num_ in [3, 6, 9, 100]: JPMorgan_Chase_fft_list_m10= np.copy(JPMorgan_Chase_fft_list); JPMorgan_Chase_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(JPMorgan_Chase_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(JPMorgan_Chase_FT['JPMorgan_Chase_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: JPMorgan_Chase (close) stock prices & Fourier transforms')plt.legend()plt.show()#KeyCorp_FFTKeyCorp_FT = SP500_TechIndicator[['Date', 'KeyCorp_Close']]KeyCorp_Close_fft = np.fft.fft(np.asarray(KeyCorp_FT['KeyCorp_Close'].tolist()))KeyCorp_fft_df = pd.DataFrame({'KeyCorp_final_fft':KeyCorp_Close_fft})KeyCorp_fft_df['KeyCorp_fft_absolute'] = KeyCorp_fft_df['KeyCorp_final_fft'].apply(lambda x: np.abs(x))KeyCorp_fft_df['KeyCorp_fft_angle'] = KeyCorp_fft_df['KeyCorp_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)KeyCorp_fft_list = np.asarray(KeyCorp_fft_df['KeyCorp_final_fft'].tolist())for num_ in [3, 6, 9, 100]: KeyCorp_fft_list_m10= np.copy(KeyCorp_fft_list); KeyCorp_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(KeyCorp_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(KeyCorp_FT['KeyCorp_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: KeyCorp (close) stock prices & Fourier transforms')plt.legend()plt.show()#Lincoln_National_FFTLincoln_National_FT = SP500_TechIndicator[['Date', 'Lincoln_National_Close']]Lincoln_National_Close_fft = np.fft.fft(np.asarray(Lincoln_National_FT['Lincoln_National_Close'].tolist()))Lincoln_National_fft_df = pd.DataFrame({'Lincoln_National_final_fft':Lincoln_National_Close_fft})Lincoln_National_fft_df['Lincoln_National_fft_absolute'] = Lincoln_National_fft_df['Lincoln_National_final_fft'].apply(lambda x: np.abs(x))Lincoln_National_fft_df['Lincoln_National_fft_angle'] = Lincoln_National_fft_df['Lincoln_National_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Lincoln_National_fft_list = np.asarray(Lincoln_National_fft_df['Lincoln_National_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Lincoln_National_fft_list_m10= np.copy(Lincoln_National_fft_list); Lincoln_National_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Lincoln_National_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Lincoln_National_FT['Lincoln_National_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Lincoln_National (close) stock prices & Fourier transforms')plt.legend()plt.show()#Loews_FFTLoews_FT = SP500_TechIndicator[['Date', 'Loews_Close']]Loews_Close_fft = np.fft.fft(np.asarray(Loews_FT['Loews_Close'].tolist()))Loews_fft_df = pd.DataFrame({'Loews_final_fft':Loews_Close_fft})Loews_fft_df['Loews_fft_absolute'] = Loews_fft_df['Loews_final_fft'].apply(lambda x: np.abs(x))Loews_fft_df['Loews_fft_angle'] = Loews_fft_df['Loews_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Loews_fft_list = np.asarray(Loews_fft_df['Loews_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Loews_fft_list_m10= np.copy(Loews_fft_list); Loews_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Loews_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Loews_FT['Loews_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Loews (close) stock prices & Fourier transforms')plt.legend()plt.show()#MT_Bank_FFTMT_Bank_FT = SP500_TechIndicator[['Date', 'MT_Bank_Close']]MT_Bank_Close_fft = np.fft.fft(np.asarray(MT_Bank_FT['MT_Bank_Close'].tolist()))MT_Bank_fft_df = pd.DataFrame({'MT_Bank_final_fft':MT_Bank_Close_fft})MT_Bank_fft_df['MT_Bank_fft_absolute'] = MT_Bank_fft_df['MT_Bank_final_fft'].apply(lambda x: np.abs(x))MT_Bank_fft_df['MT_Bank_fft_angle'] = MT_Bank_fft_df['MT_Bank_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)MT_Bank_fft_list = np.asarray(MT_Bank_fft_df['MT_Bank_final_fft'].tolist())for num_ in [3, 6, 9, 100]: MT_Bank_fft_list_m10= np.copy(MT_Bank_fft_list); MT_Bank_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(MT_Bank_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(MT_Bank_FT['MT_Bank_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: MT_Bank (close) stock prices & Fourier transforms')plt.legend()plt.show()#Marsh_McLennan_FFTMarsh_McLennan_FT = SP500_TechIndicator[['Date', 'Marsh_McLennan_Close']]Marsh_McLennan_Close_fft = np.fft.fft(np.asarray(Marsh_McLennan_FT['Marsh_McLennan_Close'].tolist()))Marsh_McLennan_fft_df = pd.DataFrame({'Marsh_McLennan_final_fft':Marsh_McLennan_Close_fft})Marsh_McLennan_fft_df['Marsh_McLennan_fft_absolute'] = Marsh_McLennan_fft_df['Marsh_McLennan_final_fft'].apply(lambda x: np.abs(x))Marsh_McLennan_fft_df['Marsh_McLennan_fft_angle'] = Marsh_McLennan_fft_df['Marsh_McLennan_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Marsh_McLennan_fft_list = np.asarray(Marsh_McLennan_fft_df['Marsh_McLennan_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Marsh_McLennan_fft_list_m10= np.copy(Marsh_McLennan_fft_list); Marsh_McLennan_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Marsh_McLennan_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Marsh_McLennan_FT['Marsh_McLennan_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Marsh_McLennan (close) stock prices & Fourier transforms')plt.legend()plt.show()#MetLife_FFTMetLife_FT = SP500_TechIndicator[['Date', 'MetLife_Close']]MetLife_Close_fft = np.fft.fft(np.asarray(MetLife_FT['MetLife_Close'].tolist()))MetLife_fft_df = pd.DataFrame({'MetLife_final_fft':MetLife_Close_fft})MetLife_fft_df['MetLife_fft_absolute'] = MetLife_fft_df['MetLife_final_fft'].apply(lambda x: np.abs(x))MetLife_fft_df['MetLife_fft_angle'] = MetLife_fft_df['MetLife_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)MetLife_fft_list = np.asarray(MetLife_fft_df['MetLife_final_fft'].tolist())for num_ in [3, 6, 9, 100]: MetLife_fft_list_m10= np.copy(MetLife_fft_list); MetLife_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(MetLife_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(MetLife_FT['MetLife_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: MetLife (close) stock prices & Fourier transforms')plt.legend()plt.show()#Moodys_FFTMoodys_FT = SP500_TechIndicator[['Date', 'Moodys_Close']]Moodys_Close_fft = np.fft.fft(np.asarray(Moodys_FT['Moodys_Close'].tolist()))Moodys_fft_df = pd.DataFrame({'Moodys_final_fft':Moodys_Close_fft})Moodys_fft_df['Moodys_fft_absolute'] = Moodys_fft_df['Moodys_final_fft'].apply(lambda x: np.abs(x))Moodys_fft_df['Moodys_fft_angle'] = Moodys_fft_df['Moodys_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Moodys_fft_list = np.asarray(Moodys_fft_df['Moodys_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Moodys_fft_list_m10= np.copy(Moodys_fft_list); Moodys_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Moodys_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Moodys_FT['Moodys_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Moodys (close) stock prices & Fourier transforms')plt.legend()plt.show()#Morgan_Stanley_FFTMorgan_Stanley_FT = SP500_TechIndicator[['Date', 'Morgan_Stanley_Close']]Morgan_Stanley_Close_fft = np.fft.fft(np.asarray(Morgan_Stanley_FT['Morgan_Stanley_Close'].tolist()))Morgan_Stanley_fft_df = pd.DataFrame({'Morgan_Stanley_final_fft':Morgan_Stanley_Close_fft})Morgan_Stanley_fft_df['Morgan_Stanley_fft_absolute'] = Morgan_Stanley_fft_df['Morgan_Stanley_final_fft'].apply(lambda x: np.abs(x))Morgan_Stanley_fft_df['Morgan_Stanley_fft_angle'] = Morgan_Stanley_fft_df['Morgan_Stanley_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Morgan_Stanley_fft_list = np.asarray(Morgan_Stanley_fft_df['Morgan_Stanley_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Morgan_Stanley_fft_list_m10= np.copy(Morgan_Stanley_fft_list); Morgan_Stanley_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Morgan_Stanley_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Morgan_Stanley_FT['Morgan_Stanley_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Morgan_Stanley (close) stock prices & Fourier transforms')plt.legend()plt.show()#MSCI_FFTMSCI_FT = SP500_TechIndicator[['Date', 'MSCI_Close']]MSCI_Close_fft = np.fft.fft(np.asarray(MSCI_FT['MSCI_Close'].tolist()))MSCI_fft_df = pd.DataFrame({'MSCI_final_fft':MSCI_Close_fft})MSCI_fft_df['MSCI_fft_absolute'] = MSCI_fft_df['MSCI_final_fft'].apply(lambda x: np.abs(x))MSCI_fft_df['MSCI_fft_angle'] = MSCI_fft_df['MSCI_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)MSCI_fft_list = np.asarray(MSCI_fft_df['MSCI_final_fft'].tolist())for num_ in [3, 6, 9, 100]: MSCI_fft_list_m10= np.copy(MSCI_fft_list); MSCI_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(MSCI_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(MSCI_FT['MSCI_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: MSCI (close) stock prices & Fourier transforms')plt.legend()plt.show()#Nasdaq_FFTNasdaq_FT = SP500_TechIndicator[['Date', 'Nasdaq_Close']]Nasdaq_Close_fft = np.fft.fft(np.asarray(Nasdaq_FT['Nasdaq_Close'].tolist()))Nasdaq_fft_df = pd.DataFrame({'Nasdaq_final_fft':Nasdaq_Close_fft})Nasdaq_fft_df['Nasdaq_fft_absolute'] = Nasdaq_fft_df['Nasdaq_final_fft'].apply(lambda x: np.abs(x))Nasdaq_fft_df['Nasdaq_fft_angle'] = Nasdaq_fft_df['Nasdaq_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Nasdaq_fft_list = np.asarray(Nasdaq_fft_df['Nasdaq_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Nasdaq_fft_list_m10= np.copy(Nasdaq_fft_list); Nasdaq_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Nasdaq_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Nasdaq_FT['Nasdaq_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Nasdaq (close) stock prices & Fourier transforms')plt.legend()plt.show()#Northern_Trust_FFTNorthern_Trust_FT = SP500_TechIndicator[['Date', 'Northern_Trust_Close']]Northern_Trust_Close_fft = np.fft.fft(np.asarray(Northern_Trust_FT['Northern_Trust_Close'].tolist()))Northern_Trust_fft_df = pd.DataFrame({'Northern_Trust_final_fft':Northern_Trust_Close_fft})Northern_Trust_fft_df['Northern_Trust_fft_absolute'] = Northern_Trust_fft_df['Northern_Trust_final_fft'].apply(lambda x: np.abs(x))Northern_Trust_fft_df['Northern_Trust_fft_angle'] = Northern_Trust_fft_df['Northern_Trust_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Northern_Trust_fft_list = np.asarray(Northern_Trust_fft_df['Northern_Trust_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Northern_Trust_fft_list_m10= np.copy(Northern_Trust_fft_list); Northern_Trust_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Northern_Trust_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Northern_Trust_FT['Northern_Trust_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Northern_Trust (close) stock prices & Fourier transforms')plt.legend()plt.show()#Peoples_United_Financial_FFTPeoples_United_Financial_FT = SP500_TechIndicator[['Date', 'Peoples_United_Financial_Close']]Peoples_United_Financial_Close_fft = np.fft.fft(np.asarray(Peoples_United_Financial_FT['Peoples_United_Financial_Close'].tolist()))Peoples_United_Financial_fft_df = pd.DataFrame({'Peoples_United_Financial_final_fft':Peoples_United_Financial_Close_fft})Peoples_United_Financial_fft_df['Peoples_United_Financial_fft_absolute'] = Peoples_United_Financial_fft_df['Peoples_United_Financial_final_fft'].apply(lambda x: np.abs(x))Peoples_United_Financial_fft_df['Peoples_United_Financial_fft_angle'] = Peoples_United_Financial_fft_df['Peoples_United_Financial_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Peoples_United_Financial_fft_list = np.asarray(Peoples_United_Financial_fft_df['Peoples_United_Financial_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Peoples_United_Financial_fft_list_m10= np.copy(Peoples_United_Financial_fft_list); Peoples_United_Financial_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Peoples_United_Financial_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Peoples_United_Financial_FT['Peoples_United_Financial_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Peoples_United_Financial (close) stock prices & Fourier transforms')plt.legend()plt.show()x
#PNC_Financial_Services_FFTPNC_Financial_Services_FT = SP500_TechIndicator[['Date', 'PNC_Financial_Services_Close']]PNC_Financial_Services_Close_fft = np.fft.fft(np.asarray(PNC_Financial_Services_FT['PNC_Financial_Services_Close'].tolist()))PNC_Financial_Services_fft_df = pd.DataFrame({'PNC_Financial_Services_final_fft':PNC_Financial_Services_Close_fft})PNC_Financial_Services_fft_df['PNC_Financial_Services_fft_absolute'] = PNC_Financial_Services_fft_df['PNC_Financial_Services_final_fft'].apply(lambda x: np.abs(x))PNC_Financial_Services_fft_df['PNC_Financial_Services_fft_angle'] = PNC_Financial_Services_fft_df['PNC_Financial_Services_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)PNC_Financial_Services_fft_list = np.asarray(PNC_Financial_Services_fft_df['PNC_Financial_Services_final_fft'].tolist())for num_ in [3, 6, 9, 100]: PNC_Financial_Services_fft_list_m10= np.copy(PNC_Financial_Services_fft_list); PNC_Financial_Services_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(PNC_Financial_Services_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(PNC_Financial_Services_FT['PNC_Financial_Services_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: PNC_Financial_Services (close) stock prices & Fourier transforms')plt.legend()plt.show()#Principal_Financial_Group_FFTPrincipal_Financial_Group_FT = SP500_TechIndicator[['Date', 'Principal_Financial_Group_Close']]Principal_Financial_Group_Close_fft = np.fft.fft(np.asarray(Principal_Financial_Group_FT['Principal_Financial_Group_Close'].tolist()))Principal_Financial_Group_fft_df = pd.DataFrame({'Principal_Financial_Group_final_fft':Principal_Financial_Group_Close_fft})Principal_Financial_Group_fft_df['Principal_Financial_Group_fft_absolute'] = Principal_Financial_Group_fft_df['Principal_Financial_Group_final_fft'].apply(lambda x: np.abs(x))Principal_Financial_Group_fft_df['Principal_Financial_Group_fft_angle'] = Principal_Financial_Group_fft_df['Principal_Financial_Group_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Principal_Financial_Group_fft_list = np.asarray(Principal_Financial_Group_fft_df['Principal_Financial_Group_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Principal_Financial_Group_fft_list_m10= np.copy(Principal_Financial_Group_fft_list); Principal_Financial_Group_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Principal_Financial_Group_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Principal_Financial_Group_FT['Principal_Financial_Group_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Principal_Financial_Group (close) stock prices & Fourier transforms')plt.legend()plt.show()#Progressive_FFTProgressive_FT = SP500_TechIndicator[['Date', 'Progressive_Close']]Progressive_Close_fft = np.fft.fft(np.asarray(Progressive_FT['Progressive_Close'].tolist()))Progressive_fft_df = pd.DataFrame({'Progressive_final_fft':Progressive_Close_fft})Progressive_fft_df['Progressive_fft_absolute'] = Progressive_fft_df['Progressive_final_fft'].apply(lambda x: np.abs(x))Progressive_fft_df['Progressive_fft_angle'] = Progressive_fft_df['Progressive_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Progressive_fft_list = np.asarray(Progressive_fft_df['Progressive_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Progressive_fft_list_m10= np.copy(Progressive_fft_list); Progressive_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Progressive_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Progressive_FT['Progressive_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Progressive (close) stock prices & Fourier transforms')plt.legend()plt.show()#Prudential_Financial_FFTPrudential_Financial_FT = SP500_TechIndicator[['Date', 'Prudential_Financial_Close']]Prudential_Financial_Close_fft = np.fft.fft(np.asarray(Prudential_Financial_FT['Prudential_Financial_Close'].tolist()))Prudential_Financial_fft_df = pd.DataFrame({'Prudential_Financial_final_fft':Prudential_Financial_Close_fft})Prudential_Financial_fft_df['Prudential_Financial_fft_absolute'] = Prudential_Financial_fft_df['Prudential_Financial_final_fft'].apply(lambda x: np.abs(x))Prudential_Financial_fft_df['Prudential_Financial_fft_angle'] = Prudential_Financial_fft_df['Prudential_Financial_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Prudential_Financial_fft_list = np.asarray(Prudential_Financial_fft_df['Prudential_Financial_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Prudential_Financial_fft_list_m10= np.copy(Prudential_Financial_fft_list); Prudential_Financial_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Prudential_Financial_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Prudential_Financial_FT['Prudential_Financial_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Prudential_Financial (close) stock prices & Fourier transforms')plt.legend()plt.show()#Raymond_James_Financial_FFTRaymond_James_Financial_FT = SP500_TechIndicator[['Date', 'Raymond_James_Financial_Close']]Raymond_James_Financial_Close_fft = np.fft.fft(np.asarray(Raymond_James_Financial_FT['Raymond_James_Financial_Close'].tolist()))Raymond_James_Financial_fft_df = pd.DataFrame({'Raymond_James_Financial_final_fft':Raymond_James_Financial_Close_fft})Raymond_James_Financial_fft_df['Raymond_James_Financial_fft_absolute'] = Raymond_James_Financial_fft_df['Raymond_James_Financial_final_fft'].apply(lambda x: np.abs(x))Raymond_James_Financial_fft_df['Raymond_James_Financial_fft_angle'] = Raymond_James_Financial_fft_df['Raymond_James_Financial_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Raymond_James_Financial_fft_list = np.asarray(Raymond_James_Financial_fft_df['Raymond_James_Financial_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Raymond_James_Financial_fft_list_m10= np.copy(Raymond_James_Financial_fft_list); Raymond_James_Financial_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Raymond_James_Financial_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Raymond_James_Financial_FT['Raymond_James_Financial_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Raymond_James_Financial (close) stock prices & Fourier transforms')plt.legend()plt.show()#Regions_Financial_FFTRegions_Financial_FT = SP500_TechIndicator[['Date', 'Regions_Financial_Close']]Regions_Financial_Close_fft = np.fft.fft(np.asarray(Regions_Financial_FT['Regions_Financial_Close'].tolist()))Regions_Financial_fft_df = pd.DataFrame({'Regions_Financial_final_fft':Regions_Financial_Close_fft})Regions_Financial_fft_df['Regions_Financial_fft_absolute'] = Regions_Financial_fft_df['Regions_Financial_final_fft'].apply(lambda x: np.abs(x))Regions_Financial_fft_df['Regions_Financial_fft_angle'] = Regions_Financial_fft_df['Regions_Financial_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Regions_Financial_fft_list = np.asarray(Regions_Financial_fft_df['Regions_Financial_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Regions_Financial_fft_list_m10= np.copy(Regions_Financial_fft_list); Regions_Financial_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Regions_Financial_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Regions_Financial_FT['Regions_Financial_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Regions_Financial (close) stock prices & Fourier transforms')plt.legend()plt.show()x
#State_Street_FFTState_Street_FT = SP500_TechIndicator[['Date', 'State_Street_Close']]State_Street_Close_fft = np.fft.fft(np.asarray(State_Street_FT['State_Street_Close'].tolist()))State_Street_fft_df = pd.DataFrame({'State_Street_final_fft':State_Street_Close_fft})State_Street_fft_df['State_Street_fft_absolute'] = State_Street_fft_df['State_Street_final_fft'].apply(lambda x: np.abs(x))State_Street_fft_df['State_Street_fft_angle'] = State_Street_fft_df['State_Street_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)State_Street_fft_list = np.asarray(State_Street_fft_df['State_Street_final_fft'].tolist())for num_ in [3, 6, 9, 100]: State_Street_fft_list_m10= np.copy(State_Street_fft_list); State_Street_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(State_Street_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(State_Street_FT['State_Street_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: State_Street (close) stock prices & Fourier transforms')plt.legend()plt.show()#SunTrust_Banks_FFTSunTrust_Banks_FT = SP500_TechIndicator[['Date', 'SunTrust_Banks_Close']]SunTrust_Banks_Close_fft = np.fft.fft(np.asarray(SunTrust_Banks_FT['SunTrust_Banks_Close'].tolist()))SunTrust_Banks_fft_df = pd.DataFrame({'SunTrust_Banks_final_fft':SunTrust_Banks_Close_fft})SunTrust_Banks_fft_df['SunTrust_Banks_fft_absolute'] = SunTrust_Banks_fft_df['SunTrust_Banks_final_fft'].apply(lambda x: np.abs(x))SunTrust_Banks_fft_df['SunTrust_Banks_fft_angle'] = SunTrust_Banks_fft_df['SunTrust_Banks_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)SunTrust_Banks_fft_list = np.asarray(SunTrust_Banks_fft_df['SunTrust_Banks_final_fft'].tolist())for num_ in [3, 6, 9, 100]: SunTrust_Banks_fft_list_m10= np.copy(SunTrust_Banks_fft_list); SunTrust_Banks_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(SunTrust_Banks_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(SunTrust_Banks_FT['SunTrust_Banks_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: SunTrust_Banks (close) stock prices & Fourier transforms')plt.legend()plt.show()#SVB_Financial_FFTSVB_Financial_FT = SP500_TechIndicator[['Date', 'SVB_Financial_Close']]SVB_Financial_Close_fft = np.fft.fft(np.asarray(SVB_Financial_FT['SVB_Financial_Close'].tolist()))SVB_Financial_fft_df = pd.DataFrame({'SVB_Financial_final_fft':SVB_Financial_Close_fft})SVB_Financial_fft_df['SVB_Financial_fft_absolute'] = SVB_Financial_fft_df['SVB_Financial_final_fft'].apply(lambda x: np.abs(x))SVB_Financial_fft_df['SVB_Financial_fft_angle'] = SVB_Financial_fft_df['SVB_Financial_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)SVB_Financial_fft_list = np.asarray(SVB_Financial_fft_df['SVB_Financial_final_fft'].tolist())for num_ in [3, 6, 9, 100]: SVB_Financial_fft_list_m10= np.copy(SVB_Financial_fft_list); SVB_Financial_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(SVB_Financial_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(SVB_Financial_FT['SVB_Financial_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: SVB_Financial (close) stock prices & Fourier transforms')plt.legend()plt.show()x
#T_Rowe_Price_Group_FFTT_Rowe_Price_Group_FT = SP500_TechIndicator[['Date', 'T_Rowe_Price_Group_Close']]T_Rowe_Price_Group_Close_fft = np.fft.fft(np.asarray(T_Rowe_Price_Group_FT['T_Rowe_Price_Group_Close'].tolist()))T_Rowe_Price_Group_fft_df = pd.DataFrame({'T_Rowe_Price_Group_final_fft':T_Rowe_Price_Group_Close_fft})T_Rowe_Price_Group_fft_df['T_Rowe_Price_Group_fft_absolute'] = T_Rowe_Price_Group_fft_df['T_Rowe_Price_Group_final_fft'].apply(lambda x: np.abs(x))T_Rowe_Price_Group_fft_df['T_Rowe_Price_Group_fft_angle'] = T_Rowe_Price_Group_fft_df['T_Rowe_Price_Group_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)T_Rowe_Price_Group_fft_list = np.asarray(T_Rowe_Price_Group_fft_df['T_Rowe_Price_Group_final_fft'].tolist())for num_ in [3, 6, 9, 100]: T_Rowe_Price_Group_fft_list_m10= np.copy(T_Rowe_Price_Group_fft_list); T_Rowe_Price_Group_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(T_Rowe_Price_Group_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(T_Rowe_Price_Group_FT['T_Rowe_Price_Group_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: T_Rowe_Price_Group (close) stock prices & Fourier transforms')plt.legend()plt.show()#Torchmark_FFTTorchmark_FT = SP500_TechIndicator[['Date', 'Torchmark_Close']]Torchmark_Close_fft = np.fft.fft(np.asarray(Torchmark_FT['Torchmark_Close'].tolist()))Torchmark_fft_df = pd.DataFrame({'Torchmark_final_fft':Torchmark_Close_fft})Torchmark_fft_df['Torchmark_fft_absolute'] = Torchmark_fft_df['Torchmark_final_fft'].apply(lambda x: np.abs(x))Torchmark_fft_df['Torchmark_fft_angle'] = Torchmark_fft_df['Torchmark_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Torchmark_fft_list = np.asarray(Torchmark_fft_df['Torchmark_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Torchmark_fft_list_m10= np.copy(Torchmark_fft_list); Torchmark_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Torchmark_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Torchmark_FT['Torchmark_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Torchmark (close) stock prices & Fourier transforms')plt.legend()plt.show()x
#US_Bancorp_FFTUS_Bancorp_FT = SP500_TechIndicator[['Date', 'US_Bancorp_Close']]US_Bancorp_Close_fft = np.fft.fft(np.asarray(US_Bancorp_FT['US_Bancorp_Close'].tolist()))US_Bancorp_fft_df = pd.DataFrame({'US_Bancorp_final_fft':US_Bancorp_Close_fft})US_Bancorp_fft_df['US_Bancorp_fft_absolute'] = US_Bancorp_fft_df['US_Bancorp_final_fft'].apply(lambda x: np.abs(x))US_Bancorp_fft_df['US_Bancorp_fft_angle'] = US_Bancorp_fft_df['US_Bancorp_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)US_Bancorp_fft_list = np.asarray(US_Bancorp_fft_df['US_Bancorp_final_fft'].tolist())for num_ in [3, 6, 9, 100]: US_Bancorp_fft_list_m10= np.copy(US_Bancorp_fft_list); US_Bancorp_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(US_Bancorp_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(US_Bancorp_FT['US_Bancorp_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: US_Bancorp (close) stock prices & Fourier transforms')plt.legend()plt.show()#Unum_Group_FFTUnum_Group_FT = SP500_TechIndicator[['Date', 'Unum_Group_Close']]Unum_Group_Close_fft = np.fft.fft(np.asarray(Unum_Group_FT['Unum_Group_Close'].tolist()))Unum_Group_fft_df = pd.DataFrame({'Unum_Group_final_fft':Unum_Group_Close_fft})Unum_Group_fft_df['Unum_Group_fft_absolute'] = Unum_Group_fft_df['Unum_Group_final_fft'].apply(lambda x: np.abs(x))Unum_Group_fft_df['Unum_Group_fft_angle'] = Unum_Group_fft_df['Unum_Group_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Unum_Group_fft_list = np.asarray(Unum_Group_fft_df['Unum_Group_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Unum_Group_fft_list_m10= np.copy(Unum_Group_fft_list); Unum_Group_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Unum_Group_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Unum_Group_FT['Unum_Group_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Unum_Group (close) stock prices & Fourier transforms')plt.legend()plt.show()#Wells_Fargo_FFTWells_Fargo_FT = SP500_TechIndicator[['Date', 'Wells_Fargo_Close']]Wells_Fargo_Close_fft = np.fft.fft(np.asarray(Wells_Fargo_FT['Wells_Fargo_Close'].tolist()))Wells_Fargo_fft_df = pd.DataFrame({'Wells_Fargo_final_fft':Wells_Fargo_Close_fft})Wells_Fargo_fft_df['Wells_Fargo_fft_absolute'] = Wells_Fargo_fft_df['Wells_Fargo_final_fft'].apply(lambda x: np.abs(x))Wells_Fargo_fft_df['Wells_Fargo_fft_angle'] = Wells_Fargo_fft_df['Wells_Fargo_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Wells_Fargo_fft_list = np.asarray(Wells_Fargo_fft_df['Wells_Fargo_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Wells_Fargo_fft_list_m10= np.copy(Wells_Fargo_fft_list); Wells_Fargo_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Wells_Fargo_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Wells_Fargo_FT['Wells_Fargo_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Wells_Fargo (close) stock prices & Fourier transforms')plt.legend()plt.show()x
#Zions_Bancorp_FFTZions_Bancorp_FT = SP500_TechIndicator[['Date', 'Zions_Bancorp_Close']]Zions_Bancorp_Close_fft = np.fft.fft(np.asarray(Zions_Bancorp_FT['Zions_Bancorp_Close'].tolist()))Zions_Bancorp_fft_df = pd.DataFrame({'Zions_Bancorp_final_fft':Zions_Bancorp_Close_fft})Zions_Bancorp_fft_df['Zions_Bancorp_fft_absolute'] = Zions_Bancorp_fft_df['Zions_Bancorp_final_fft'].apply(lambda x: np.abs(x))Zions_Bancorp_fft_df['Zions_Bancorp_fft_angle'] = Zions_Bancorp_fft_df['Zions_Bancorp_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Zions_Bancorp_fft_list = np.asarray(Zions_Bancorp_fft_df['Zions_Bancorp_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Zions_Bancorp_fft_list_m10= np.copy(Zions_Bancorp_fft_list); Zions_Bancorp_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Zions_Bancorp_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Zions_Bancorp_FT['Zions_Bancorp_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Zions_Bancorp (close) stock prices & Fourier transforms')plt.legend()plt.show()#Abbott_Laboratories_FFTAbbott_Laboratories_FT = SP500_TechIndicator[['Date', 'Abbott_Laboratories_Close']]Abbott_Laboratories_Close_fft = np.fft.fft(np.asarray(Abbott_Laboratories_FT['Abbott_Laboratories_Close'].tolist()))Abbott_Laboratories_fft_df = pd.DataFrame({'Abbott_Laboratories_final_fft':Abbott_Laboratories_Close_fft})Abbott_Laboratories_fft_df['Abbott_Laboratories_fft_absolute'] = Abbott_Laboratories_fft_df['Abbott_Laboratories_final_fft'].apply(lambda x: np.abs(x))Abbott_Laboratories_fft_df['Abbott_Laboratories_fft_angle'] = Abbott_Laboratories_fft_df['Abbott_Laboratories_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Abbott_Laboratories_fft_list = np.asarray(Abbott_Laboratories_fft_df['Abbott_Laboratories_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Abbott_Laboratories_fft_list_m10= np.copy(Abbott_Laboratories_fft_list); Abbott_Laboratories_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Abbott_Laboratories_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Abbott_Laboratories_FT['Abbott_Laboratories_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Abbott_Laboratories (close) stock prices & Fourier transforms')plt.legend()plt.show()#AbbVie_FFTAbbVie_FT = SP500_TechIndicator[['Date', 'AbbVie_Close']]AbbVie_Close_fft = np.fft.fft(np.asarray(AbbVie_FT['AbbVie_Close'].tolist()))AbbVie_fft_df = pd.DataFrame({'AbbVie_final_fft':AbbVie_Close_fft})AbbVie_fft_df['AbbVie_fft_absolute'] = AbbVie_fft_df['AbbVie_final_fft'].apply(lambda x: np.abs(x))AbbVie_fft_df['AbbVie_fft_angle'] = AbbVie_fft_df['AbbVie_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)AbbVie_fft_list = np.asarray(AbbVie_fft_df['AbbVie_final_fft'].tolist())for num_ in [3, 6, 9, 100]: AbbVie_fft_list_m10= np.copy(AbbVie_fft_list); AbbVie_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(AbbVie_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(AbbVie_FT['AbbVie_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: AbbVie (close) stock prices & Fourier transforms')plt.legend()plt.show()#ABIOMED_FFTABIOMED_FT = SP500_TechIndicator[['Date', 'ABIOMED_Close']]ABIOMED_Close_fft = np.fft.fft(np.asarray(ABIOMED_FT['ABIOMED_Close'].tolist()))ABIOMED_fft_df = pd.DataFrame({'ABIOMED_final_fft':ABIOMED_Close_fft})ABIOMED_fft_df['ABIOMED_fft_absolute'] = ABIOMED_fft_df['ABIOMED_final_fft'].apply(lambda x: np.abs(x))ABIOMED_fft_df['ABIOMED_fft_angle'] = ABIOMED_fft_df['ABIOMED_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)ABIOMED_fft_list = np.asarray(ABIOMED_fft_df['ABIOMED_final_fft'].tolist())for num_ in [3, 6, 9, 100]: ABIOMED_fft_list_m10= np.copy(ABIOMED_fft_list); ABIOMED_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(ABIOMED_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(ABIOMED_FT['ABIOMED_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: ABIOMED (close) stock prices & Fourier transforms')plt.legend()plt.show()#Agilent_FFTAgilent_FT = SP500_TechIndicator[['Date', 'Agilent_Close']]Agilent_Close_fft = np.fft.fft(np.asarray(Agilent_FT['Agilent_Close'].tolist()))Agilent_fft_df = pd.DataFrame({'Agilent_final_fft':Agilent_Close_fft})Agilent_fft_df['Agilent_fft_absolute'] = Agilent_fft_df['Agilent_final_fft'].apply(lambda x: np.abs(x))Agilent_fft_df['Agilent_fft_angle'] = Agilent_fft_df['Agilent_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Agilent_fft_list = np.asarray(Agilent_fft_df['Agilent_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Agilent_fft_list_m10= np.copy(Agilent_fft_list); Agilent_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Agilent_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Agilent_FT['Agilent_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Agilent (close) stock prices & Fourier transforms')plt.legend()plt.show()x
#Align_Technology_FFTAlign_Technology_FT = SP500_TechIndicator[['Date', 'Align_Technology_Close']]Align_Technology_Close_fft = np.fft.fft(np.asarray(Align_Technology_FT['Align_Technology_Close'].tolist()))Align_Technology_fft_df = pd.DataFrame({'Align_Technology_final_fft':Align_Technology_Close_fft})Align_Technology_fft_df['Align_Technology_fft_absolute'] = Align_Technology_fft_df['Align_Technology_final_fft'].apply(lambda x: np.abs(x))Align_Technology_fft_df['Align_Technology_fft_angle'] = Align_Technology_fft_df['Align_Technology_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Align_Technology_fft_list = np.asarray(Align_Technology_fft_df['Align_Technology_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Align_Technology_fft_list_m10= np.copy(Align_Technology_fft_list); Align_Technology_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Align_Technology_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Align_Technology_FT['Align_Technology_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Align_Technology (close) stock prices & Fourier transforms')plt.legend()plt.show()#Allergan_FFTAllergan_FT = SP500_TechIndicator[['Date', 'Allergan_Close']]Allergan_Close_fft = np.fft.fft(np.asarray(Allergan_FT['Allergan_Close'].tolist()))Allergan_fft_df = pd.DataFrame({'Allergan_final_fft':Allergan_Close_fft})Allergan_fft_df['Allergan_fft_absolute'] = Allergan_fft_df['Allergan_final_fft'].apply(lambda x: np.abs(x))Allergan_fft_df['Allergan_fft_angle'] = Allergan_fft_df['Allergan_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Allergan_fft_list = np.asarray(Allergan_fft_df['Allergan_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Allergan_fft_list_m10= np.copy(Allergan_fft_list); Allergan_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Allergan_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Allergan_FT['Allergan_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Allergan (close) stock prices & Fourier transforms')plt.legend()plt.show()#AmerisourceBergen_Corp_FFTAmerisourceBergen_Corp_FT = SP500_TechIndicator[['Date', 'AmerisourceBergen_Corp_Close']]AmerisourceBergen_Corp_Close_fft = np.fft.fft(np.asarray(AmerisourceBergen_Corp_FT['AmerisourceBergen_Corp_Close'].tolist()))AmerisourceBergen_Corp_fft_df = pd.DataFrame({'AmerisourceBergen_Corp_final_fft':AmerisourceBergen_Corp_Close_fft})AmerisourceBergen_Corp_fft_df['AmerisourceBergen_Corp_fft_absolute'] = AmerisourceBergen_Corp_fft_df['AmerisourceBergen_Corp_final_fft'].apply(lambda x: np.abs(x))AmerisourceBergen_Corp_fft_df['AmerisourceBergen_Corp_fft_angle'] = AmerisourceBergen_Corp_fft_df['AmerisourceBergen_Corp_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)AmerisourceBergen_Corp_fft_list = np.asarray(AmerisourceBergen_Corp_fft_df['AmerisourceBergen_Corp_final_fft'].tolist())for num_ in [3, 6, 9, 100]: AmerisourceBergen_Corp_fft_list_m10= np.copy(AmerisourceBergen_Corp_fft_list); AmerisourceBergen_Corp_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(AmerisourceBergen_Corp_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(AmerisourceBergen_Corp_FT['AmerisourceBergen_Corp_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: AmerisourceBergen_Corp (close) stock prices & Fourier transforms')plt.legend()plt.show()#Amgen_FFTAmgen_FT = SP500_TechIndicator[['Date', 'Amgen_Close']]Amgen_Close_fft = np.fft.fft(np.asarray(Amgen_FT['Amgen_Close'].tolist()))Amgen_fft_df = pd.DataFrame({'Amgen_final_fft':Amgen_Close_fft})Amgen_fft_df['Amgen_fft_absolute'] = Amgen_fft_df['Amgen_final_fft'].apply(lambda x: np.abs(x))Amgen_fft_df['Amgen_fft_angle'] = Amgen_fft_df['Amgen_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Amgen_fft_list = np.asarray(Amgen_fft_df['Amgen_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Amgen_fft_list_m10= np.copy(Amgen_fft_list); Amgen_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Amgen_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Amgen_FT['Amgen_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Amgen (close) stock prices & Fourier transforms')plt.legend()plt.show()x
#Baxter_International_FFTBaxter_International_FT = SP500_TechIndicator[['Date', 'Baxter_International_Close']]Baxter_International_Close_fft = np.fft.fft(np.asarray(Baxter_International_FT['Baxter_International_Close'].tolist()))Baxter_International_fft_df = pd.DataFrame({'Baxter_International_final_fft':Baxter_International_Close_fft})Baxter_International_fft_df['Baxter_International_fft_absolute'] = Baxter_International_fft_df['Baxter_International_final_fft'].apply(lambda x: np.abs(x))Baxter_International_fft_df['Baxter_International_fft_angle'] = Baxter_International_fft_df['Baxter_International_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Baxter_International_fft_list = np.asarray(Baxter_International_fft_df['Baxter_International_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Baxter_International_fft_list_m10= np.copy(Baxter_International_fft_list); Baxter_International_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Baxter_International_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Baxter_International_FT['Baxter_International_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Baxter_International (close) stock prices & Fourier transforms')plt.legend()plt.show()#Becton_Dickinson_FFTBecton_Dickinson_FT = SP500_TechIndicator[['Date', 'Becton_Dickinson_Close']]Becton_Dickinson_Close_fft = np.fft.fft(np.asarray(Becton_Dickinson_FT['Becton_Dickinson_Close'].tolist()))Becton_Dickinson_fft_df = pd.DataFrame({'Becton_Dickinson_final_fft':Becton_Dickinson_Close_fft})Becton_Dickinson_fft_df['Becton_Dickinson_fft_absolute'] = Becton_Dickinson_fft_df['Becton_Dickinson_final_fft'].apply(lambda x: np.abs(x))Becton_Dickinson_fft_df['Becton_Dickinson_fft_angle'] = Becton_Dickinson_fft_df['Becton_Dickinson_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Becton_Dickinson_fft_list = np.asarray(Becton_Dickinson_fft_df['Becton_Dickinson_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Becton_Dickinson_fft_list_m10= np.copy(Becton_Dickinson_fft_list); Becton_Dickinson_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Becton_Dickinson_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Becton_Dickinson_FT['Becton_Dickinson_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Becton_Dickinson (close) stock prices & Fourier transforms')plt.legend()plt.show()#Biogen_FFTBiogen_FT = SP500_TechIndicator[['Date', 'Biogen_Close']]Biogen_Close_fft = np.fft.fft(np.asarray(Biogen_FT['Biogen_Close'].tolist()))Biogen_fft_df = pd.DataFrame({'Biogen_final_fft':Biogen_Close_fft})Biogen_fft_df['Biogen_fft_absolute'] = Biogen_fft_df['Biogen_final_fft'].apply(lambda x: np.abs(x))Biogen_fft_df['Biogen_fft_angle'] = Biogen_fft_df['Biogen_final_fft'].apply(lambda x: np.angle(x))plt.figure(figsize=(14, 7), dpi=100)Biogen_fft_list = np.asarray(Biogen_fft_df['Biogen_final_fft'].tolist())for num_ in [3, 6, 9, 100]: Biogen_fft_list_m10= np.copy(Biogen_fft_list); Biogen_fft_list_m10[num_:-num_]=0 plt.plot(np.fft.ifft(Biogen_fft_list_m10), label='Fourier transform with {} components'.format(num_))plt.plot(Biogen_FT['Biogen_Close'], label='Real')plt.xlabel('Days')plt.ylabel('USD')plt.title('Figure: Biogen (close) stock prices & Fourier transforms')plt.legend()plt.show()